public void AddToEmptyChangelog() { string result = ChangeLogUpdater.AddEntry(changeLog: string.Empty, type: "Added", message: "Added a new entry"); const string expected = @"# Changelog All notable changes to this project will be documented in this file. <!-- Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release --> ## [Unreleased] ### Added - Added a new entry ### Fixed ### Changed ### Removed ### Deployment Changes <!-- Releases that have at least been deployed to staging, BUT NOT necessarily released to live. Changes should be moved from [Unreleased] into here as they are merged into the appropriate release branch --> ## [0.0.0] - Project created"; Assert.Equal(expected: expected, actual: result); }
public void CannotCreateAReleaseOlderThanLatest() { const string changeLog = @"# Changelog All notable changes to this project will be documented in this file. <!-- Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release --> ## [Unreleased] ### Added ### Fixed ### Changed - Something. ### Removed ### Deployment Changes <!-- Releases that have at least been deployed to staging, BUT NOT necessarily released to live. Changes should be moved from [Unreleased] into here as they are merged into the appropriate release branch --> ## [2.0.0] - 2020-11-23 ## Added - An Item ## [0.0.0] - Project created"; Assert.Throws <ReleaseTooOldException>(() => ChangeLogUpdater.CreateRelease(changeLog: changeLog, version: "1.0.0", pending: true)); }
public void AddToExistingChangelogForSectionThatDoesNotExistFails() { const string existing = @"# Changelog All notable changes to this project will be documented in this file. <!-- Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release --> ## [Unreleased] ### Fixed ### Changed ### Removed ### Deployment Changes <!-- Releases that have at least been deployed to staging, BUT NOT necessarily released to live. Changes should be moved from [Unreleased] into here as they are merged into the appropriate release branch --> ## [0.0.1] - 2020-12-29 ### Added - Added a new entry ## [0.0.0] - Project created"; Assert.Throws <InvalidChangeLogException>(() => ChangeLogUpdater.AddEntry(changeLog: existing, type: "Added", message: "Another entry")); }
public void ChangeLogWithOnlyRemovedInUnreleasedProducesReleaseWithJustAdded() { const string changeLog = @"# Changelog All notable changes to this project will be documented in this file. <!-- Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release --> ## [Unreleased] ### Added ### Fixed ### Changed ### Removed - Some Content ### Deployment Changes <!-- Releases that have at least been deployed to staging, BUT NOT necessarily released to live. Changes should be moved from [Unreleased] into here as they are merged into the appropriate release branch --> ## [0.0.0] - Project created"; string updated = ChangeLogUpdater.CreateRelease(changeLog: changeLog, version: "1.0.0", pending: true); const string expected = @"# Changelog All notable changes to this project will be documented in this file. <!-- Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release --> ## [Unreleased] ### Added ### Fixed ### Changed ### Removed ### Deployment Changes <!-- Releases that have at least been deployed to staging, BUT NOT necessarily released to live. Changes should be moved from [Unreleased] into here as they are merged into the appropriate release branch --> ## [1.0.0] - TBD ### Removed - Some Content ## [0.0.0] - Project created"; this._output.WriteLine(updated); Assert.Equal(expected: expected, actual: updated); }