@@ -8,33 +8,33 @@ open Faqt.Operators
88open Microsoft.VisualStudio .TestTools .UnitTesting
99open Workspace
1010
11- type TestContext =
12- {
13- BuildEngine: Mock < IBuildEngine >
14- Errors: ResizeArray < BuildErrorEventArgs >
15- }
11+ type TestContext = {
12+ BuildEngine: Mock < IBuildEngine >
13+ Errors: ResizeArray < BuildErrorEventArgs >
14+ } with
1615
1716 member this.PrintErrors () =
1817 this.Errors |> Seq.iter ( fun error -> printfn " Error: %s " error.Message)
18+
1919[<TestClass>]
2020type UnitTests () =
2121
2222 member val context = Unchecked.defaultof< TestContext> with get, set
23+
2324 [<TestInitialize>]
2425 member this.Initialize () =
25- this.context <-
26- {
27- BuildEngine = Mock< IBuildEngine>()
28- Errors = ResizeArray< BuildErrorEventArgs>()
29- }
26+ this.context <- {
27+ BuildEngine = Mock< IBuildEngine>()
28+ Errors = ResizeArray< BuildErrorEventArgs>()
29+ }
3030
3131 this.context.BuildEngine
3232 .Setup( fun engine -> engine.LogErrorEvent( It.IsAny< BuildErrorEventArgs>()))
3333 .Callback( fun ( args : BuildErrorEventArgs ) -> this.context.Errors.Add( args))
3434 |> ignore
3535
3636 [<TestMethod>]
37- member this. ``task fails when changelog file does not exist`` () =
37+ member this. ``task fails when changelog file does not exist`` () =
3838
3939 let myTask = ParseChangeLogs( ChangelogFile = " ThisFileDoesNotExist.md" )
4040 myTask.BuildEngine <- this.context.BuildEngine.Object
@@ -46,7 +46,7 @@ type UnitTests() =
4646 % this.context.Errors.[ 0 ]. Code.Should() .Be( " IKC0001" )
4747
4848 [<TestMethod>]
49- member this. ``task succeeds when changelog file exists ( relative path ) `` () =
49+ member this. ``task succeeds when changelog file exists ( relative path ) ``() =
5050 // When running tests, the working directory is where the dll is located
5151 let myTask = ParseChangeLogs( ChangelogFile = " ../../../changelogs/CHANGELOG.md" )
5252
@@ -60,7 +60,7 @@ type UnitTests() =
6060 % this.context.Errors.Count.Should() .Be( 0 )
6161
6262 [<TestMethod>]
63- member this. ``task succeeds when changelog file exists ( absolute path ) `` () =
63+ member this. ``task succeeds when changelog file exists ( absolute path ) ``() =
6464 let myTask = ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG.md `` )
6565 myTask.BuildEngine <- this.context.BuildEngine.Object
6666
@@ -70,7 +70,7 @@ type UnitTests() =
7070 % this.context.Errors.Count.Should() .Be( 0 )
7171
7272 [<TestMethod>]
73- member this. ``task fails when changelog file is invalid`` () =
73+ member this. ``task fails when changelog file is invalid`` () =
7474 let myTask =
7575 ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG_invalid.md `` )
7676
@@ -82,9 +82,8 @@ type UnitTests() =
8282 % this.context.Errors.Count.Should() .Be( 1 )
8383 % this.context.Errors.[ 0 ]. Code.Should() .Be( " IKC0002" )
8484
85-
8685 [<TestMethod>]
87- member this. ``task correctly parses details from changelog file`` () =
86+ member this. ``task correctly parses details from changelog file`` () =
8887 let myTask =
8988 ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG_detailed.md `` )
9089
@@ -93,26 +92,42 @@ type UnitTests() =
9392 let success = myTask.Execute()
9493 % success.Should() .BeTrue " Should have successfully parsed the changelog data"
9594 % myTask.AllReleasedChangelogs.Length.Should() .Be( 9 , " Should have 9 versions" )
96- % myTask.CurrentReleaseChangelog.ItemSpec.Should() .Be( " 0.1.8" , " Should have the most recent version" )
97- % myTask.CurrentReleaseChangelog.GetMetadata( " Date" ) .Should() .Be( " 2022-03-31" , " Should have the most recent version's date" )
98- %( myTask.CurrentReleaseChangelog.MetadataNames |> Seq.cast |> _. Should() .Contain( " Changed" , " Should have changed metadata" ))
99- %( myTask.CurrentReleaseChangelog.MetadataNames |> Seq.cast |> _. Should() .Contain( " Date" , " Should have date metadata" ))
95+
96+ % myTask.CurrentReleaseChangelog.ItemSpec
97+ .Should()
98+ .Be( " 0.1.8" , " Should have the most recent version" )
99+
100+ % myTask.CurrentReleaseChangelog
101+ .GetMetadata( " Date" )
102+ .Should()
103+ .Be( " 2022-03-31" , " Should have the most recent version's date" )
104+
105+ %( myTask.CurrentReleaseChangelog.MetadataNames
106+ |> Seq.cast
107+ |> _. Should() .Contain( " Changed" , " Should have changed metadata" ))
108+
109+ %( myTask.CurrentReleaseChangelog.MetadataNames
110+ |> Seq.cast
111+ |> _. Should() .Contain( " Date" , " Should have date metadata" ))
100112
101113 [<TestMethod>]
102- member this. ``task produces expected markdown`` () =
103- let myTask =
104- ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG.md `` )
114+ member this. ``task produces expected markdown`` () =
115+ let myTask = ParseChangeLogs( ChangelogFile = Workspace.changelogs.`` CHANGELOG.md `` )
105116
106117 myTask.BuildEngine <- this.context.BuildEngine.Object
107118
108119 let success = myTask.Execute()
109120 % success.Should() .BeTrue " Should have successfully parsed the changelog data"
110- % myTask.LatestReleaseNotes.Should() .Be( """ ### Added
121+
122+ % myTask.LatestReleaseNotes
123+ .Should()
124+ .Be(
125+ """ ### Added
111126
112127- Created the package
113128
114129### Changed
115130
116131- Changed something in the package
117- - Updated the target framework""" )
118-
132+ - Updated the target framework"""
133+ )
0 commit comments