using Microsoft.VisualStudio.TestTools.UnitTesting; using PSReleaseNotesGenerator; using System.Collections.Generic; namespace ReleaseNotesGeneratorTests { [TestClass] public class BreakingChangesTests { const string emptyXML = "\r\n"; [TestMethod] public void TestCreateBreakingChangesLookup_Empty() { var breakingChanges = new BreakingChanges(); var xml = breakingChanges.CreateLookupXML(new HashSet()); Assert.IsNotNull(xml); Assert.AreEqual(emptyXML, xml); } [TestMethod] public void TestCreateBreakingChangesLookup_NoOverrides() { var expectedXML = @" [Breaking Change] the reason for the breaking change. "; var breakingChanges = new BreakingChanges(); breakingChanges.Add("ES", "[Breaking Change] the reason for the breaking change."); var xml = breakingChanges.CreateLookupXML(new HashSet()); Assert.IsNotNull(xml); Assert.AreEqual(expectedXML, xml); } [TestMethod] public void TestCreateBreakingChangesLookup_OneOverrideAndCoreBreaks() { var expectedXML = @" <" + BreakingChanges.SharedSourceCodeKey + @" InOverrides=""false""> [Breaking Change] the reason for the core breaking change. [Breaking Change] the reason for the breaking change. [Breaking Change] the 2nd reason for the breaking change. "; var breakingChanges = new BreakingChanges(); breakingChanges.Add("", "[Breaking Change] the reason for the core breaking change."); breakingChanges.Add("ES", "[Breaking Change] the reason for the breaking change."); breakingChanges.Add("ES", "[Breaking Change] the 2nd reason for the breaking change."); var xml = breakingChanges.CreateLookupXML(new HashSet() { "ES" }); Assert.IsNotNull(xml); Assert.AreEqual(expectedXML, xml); } } }