@@ -92,7 +92,7 @@ type UnitTests() =
9292 myTask.BuildEngine <- this.context.BuildEngine.Object
9393
9494 let success = myTask.Execute()
95- % success.Should() .BeTrue " Should have successfully parsed the changelog data"
95+ % success.Should() .BeTrue( " Should have successfully parsed the changelog data" )
9696 % myTask.AllReleasedChangelogs.Length.Should() .Be( 9 , " Should have 9 versions" )
9797
9898 % myTask.CurrentReleaseChangelog.ItemSpec
@@ -112,45 +112,93 @@ type UnitTests() =
112112 |> Seq.cast
113113 |> _. Should() .Contain( " Date" , " Should have date metadata" ))
114114
115+ % myTask.UnreleasedChangelog.ItemSpec
116+ .Should()
117+ .Be( " 0.1.9-alpha" , " Should have the alpha prefix from a patch release" )
118+
119+ %( myTask.UnreleasedChangelog.MetadataNames
120+ |> Seq.cast
121+ |> _. Should() .Contain( " Removed" , " Should have removed metadata" ))
122+
115123 [<TestMethod>]
116124 member this. ``task produces expected markdown`` () =
117- let myTask = ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG.md `` )
125+ let myTask =
126+ ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG_detailed.md `` )
118127
119128 myTask.BuildEngine <- this.context.BuildEngine.Object
120129
121130 let success = myTask.Execute()
122- % success.Should() .BeTrue " Should have successfully parsed the changelog data"
131+ % success.Should() .BeTrue( " Should have successfully parsed the changelog data" )
123132
124133 % myTask.LatestReleaseNotes
125134 .Should()
126135 .BeLineEndingEquivalent(
127- """ ### Added
128-
129- - Created the package
130-
131- ### Changed
136+ """ ### Changed
132137
133- - Changed something in the package
134- - Updated the target framework"""
138+ - Minor packaging fix for non-Core MSBuild versions"""
135139 )
136-
140+
137141 % myTask.UnreleasedReleaseNotes
138142 .Should()
139143 .BeLineEndingEquivalent(
140144 """ ### Removed
141145
142146- A test removal line
143- - And another removal""" )
147+ - And another removal"""
148+ )
149+
144150 [<TestMethod>]
145- member this. ``task produces correct versions `` () =
151+ member this. ``task correctly processes a changelog with no unreleased `` () =
146152 let myTask = ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG.md `` )
147153
148154 myTask.BuildEngine <- this.context.BuildEngine.Object
149155
150156 let success = myTask.Execute()
151- % success.Should() .BeTrue " Should have successfully parsed the changelog data"
157+ % success.Should() .BeTrue( " Should have successfully parsed the changelog data" )
158+
159+ % myTask.CurrentReleaseChangelog.ItemSpec
160+ .Should()
161+ .Be( " 0.1.0" , " It is the latest release" )
162+
163+ % myTask.LatestReleaseNotes.Should() .NotBeNull() .And.NotBeEmpty()
164+
165+ % myTask.AllReleasedChangelogs
166+ .Should()
167+ .HaveLength( 1 , " There is only a single release section" )
152168
153- % myTask.CurrentReleaseChangelog.ItemSpec.Should() .Be( " 0.1.0" )
154- % myTask.UnreleasedChangelog.ItemSpec.Should() .Be( " 0.1.1-alpha" )
155-
156-
169+ % myTask.UnreleasedChangelog.Should() .BeNull( " There is no unreleased section" )
170+ % myTask.UnreleasedReleaseNotes.Should() .BeNull( " There is no unreleased section" )
171+
172+ [<TestMethod>]
173+ member this. ``task correctly processes a changelog with only unreleased`` () =
174+ let myTask =
175+ ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG_unreleased.md `` )
176+
177+ myTask.BuildEngine <- this.context.BuildEngine.Object
178+
179+ let success = myTask.Execute()
180+ % success.Should() .BeTrue( " Should have successfully parsed the changelog data" )
181+ % myTask.CurrentReleaseChangelog.Should() .BeNull( " There are no released sections" )
182+ % myTask.LatestReleaseNotes.Should() .BeNull( " There are no released sections" )
183+ % myTask.AllReleasedChangelogs.Should() .BeEmpty( " There are no released sections" )
184+
185+ % myTask.UnreleasedChangelog.ItemSpec
186+ .Should()
187+ .Be( " 0.0.1-alpha" , " There is no previous version, so it starts from 0.0.0" )
188+
189+ % myTask.UnreleasedReleaseNotes.Should() .NotBeNull() .And.NotBeEmpty()
190+
191+ [<TestMethod>]
192+ member this. ``task correctly processes a changelog with only introduction`` () =
193+ let myTask =
194+ ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG_empty.md `` )
195+
196+ myTask.BuildEngine <- this.context.BuildEngine.Object
197+
198+ let success = myTask.Execute()
199+ % success.Should() .BeTrue( " Should have successfully parsed the changelog data" )
200+ % myTask.CurrentReleaseChangelog.Should() .BeNull( " There are no released sections" )
201+ % myTask.LatestReleaseNotes.Should() .BeNull( " There are no released sections" )
202+ % myTask.AllReleasedChangelogs.Should() .BeEmpty( " There are no released sections" )
203+ % myTask.UnreleasedChangelog.Should() .BeNull( " There is no unreleased section" )
204+ % myTask.UnreleasedReleaseNotes.Should() .BeNull( " There is no unreleased section" )
0 commit comments