public void UpdateDebianChangelogAllMdListItemsWork() { var testingTask = new GenerateReleaseArtifacts(); using(var tempFiles = new TwoTempFilesForTest(Path.Combine(Path.GetTempPath(), "Test.md"), Path.Combine(Path.GetTempPath(), "changelog"))) { var markdownFile = tempFiles.FirstFile; File.WriteAllLines(markdownFile, new[] { "## 3.0.97 Beta", "- Update French UI Translation", "+ When importing, Bloom no longer", " 1. makes images transparent when importing.", " 4. compresses images transparent when importing.", " 9. saves copyright/license back to the original files", " * extra indented list", "* Fix insertion of unwanted space before bolded, underlined, and italicized portions of words", }); var debianChangelog = tempFiles.SecondFile; File.WriteAllLines(debianChangelog, new[] { "Bloom (3.0.82 Beta) unstable; urgency=low", "", " * Older release", "", " -- Stephen McConnel <*****@*****.**> Fri, 12 Jul 2014 14:57:59 -0500", "" }); testingTask.MarkdownFile = markdownFile; testingTask.VersionNumber = "3.0.97 Beta"; testingTask.ProductName = "myfavoriteapp"; testingTask.ChangelogAuthorInfo = "John Hatton <*****@*****.**>"; testingTask.DebianChangelog = debianChangelog; Assert.That(testingTask.UpdateDebianChangelog(), Is.True); var newContents = File.ReadAllLines(debianChangelog); Assert.That(newContents[0], Is.StringContaining("3.0.97 Beta")); Assert.That(newContents[2], Is.StringStarting(" *")); Assert.That(newContents[3], Is.StringStarting(" *")); Assert.That(newContents[4], Is.StringStarting(" *")); Assert.That(newContents[5], Is.StringStarting(" *")); Assert.That(newContents[6], Is.StringStarting(" *")); Assert.That(newContents[7], Is.StringStarting(" *")); // The 3rd (and further) level indentation isn't currently supported Assert.That(newContents[8], Is.StringStarting(" *")); } }
public void UpdateDebianChangelogWorks() { var testMarkdown = new GenerateReleaseArtifacts(); using(var tempFiles = new TwoTempFilesForTest(Path.Combine(Path.GetTempPath(), "Test.md"), Path.Combine(Path.GetTempPath(), "changelog"))) { var mdFile = tempFiles.FirstFile; var changeLogFile = tempFiles.SecondFile; File.WriteAllLines(mdFile, new[] {"## 2.3.10: 4/Sep/2014", "* with some random content", "* does some things"}); File.WriteAllLines(changeLogFile, new[] { "myfavoriteapp (2.1.0~alpha1) unstable; urgency=low", "", " * Initial Release for Linux.", "", " -- Stephen McConnel <*****@*****.**> Fri, 12 Jul 2013 14:57:59 -0500", "" }); testMarkdown.MarkdownFile = mdFile; testMarkdown.VersionNumber = "2.3.11"; testMarkdown.ProductName = "myfavoriteapp"; testMarkdown.ChangelogAuthorInfo = "Steve McConnel <*****@*****.**>"; testMarkdown.DebianChangelog = changeLogFile; Assert.That(testMarkdown.UpdateDebianChangelog(), Is.True); var newContents = File.ReadAllLines(changeLogFile); Assert.AreEqual(newContents.Length, 13, "New changelog entry was not the expected length"); Assert.That(newContents[0], Is.StringStarting("myfavoriteapp (2.3.11) unstable; urgency=low")); //Make sure that the author line matches debian standards for time offset and spacing around author name Assert.That(newContents[5], Is.StringMatching(" -- " + testMarkdown.ChangelogAuthorInfo + " .*[+-]\\d\\d\\d\\d")); } }