@@ -4,6 +4,7 @@ namespace UnitTesting
44
55open System
66open System.Collections .Immutable
7+ open System.Collections .Generic
78open System.Threading .Tasks
89open NUnit.Framework
910open Pulumi
@@ -14,52 +15,70 @@ open FluentAssertions
1415
1516[<TestFixture>]
1617type WebserverStackTests () =
17- let runTest () : ImmutableArray < Resource > =
18+ let runTest () : ImmutableArray < Resource > =
1819 let options = new TestOptions( IsPreview = Nullable< bool> false )
20+
1921 Deployment.TestAsync< WebsiteStack>( new Mocks(), options)
2022 |> Async.AwaitTask
2123 |> Async.RunSynchronously
22-
23- let getValue ( output : Output < 'a >): 'a =
24+
25+ let getValue ( output : Output < 'a >) : 'a =
2426 let tcs = new TaskCompletionSource< 'a>()
25- output.Apply( fun v -> tcs.SetResult( v); v) |> ignore
27+
28+ output.Apply( fun v ->
29+ tcs.SetResult( v)
30+ v)
31+ |> ignore
32+
2633 tcs.Task.Result
2734
2835 [<Test>]
2936 member this.SingleResourceGroupExists () =
30- let resources = runTest()
37+ let resources = runTest ()
3138
3239 let resourceGroupCount = resources.OfType< ResourceGroup>() |> Seq.length
33- resourceGroupCount.Should() .Be( 1 , " a single resource group is expected" ) |> ignore
40+
41+ ( resourceGroupCount :> obj) .Should() .Be( 1 , " a single resource group is expected" )
42+ |> ignore
3443
3544 [<Test>]
3645 member this.ResourceGroupHasEnvironmentTag () =
37- let resources = runTest()
46+ let resources = runTest ()
3847 let resourceGroup = resources.OfType< ResourceGroup>() |> Seq.head
3948
4049 let tags = getValue resourceGroup.Tags
41- tags.Should() .NotBeNull( " Tags must be defined" ) |> ignore
42- tags.Should() .ContainKey( " Environment" , null ) |> ignore
50+
51+ ( tags :> obj) .Should() .NotBeNull( " Tags must be defined" )
52+ |> ignore
53+
54+ ( tags :> System.Collections.Generic.IDictionary< string, string>) .Should() .ContainKey( " Environment" , null )
55+ |> ignore
4356
4457 [<Test>]
4558 member this.StorageAccountBelongsToResourceGroup () =
46- let resources = runTest()
59+ let resources = runTest ()
4760 let storageAccount = resources.OfType< Account>() |> Seq.tryHead |> Option.toObj
48- storageAccount.Should() .NotBeNull( " Storage account not found" ) |> ignore
49-
61+
62+ ( storageAccount :> obj) .Should() .NotBeNull( " Storage account not found" )
63+ |> ignore
64+
5065 let resourceGroupName = getValue storageAccount.ResourceGroupName
51- resourceGroupName.Should() .Be( " www-prod-rg" , null ) |> ignore
66+ ( resourceGroupName :> obj ) .Should() .Be( " www-prod-rg" , null ) |> ignore
5267
5368 [<Test>]
5469 member this.UploadsTwoFiles () =
55- let resources = runTest()
70+ let resources = runTest ()
5671 let filesCount = resources.OfType< Blob>() |> Seq.length
57- filesCount.Should() .Be( 2 , " Should have uploaded files from `wwwroot`" ) |> ignore
58-
72+
73+ ( filesCount :> obj) .Should() .Be( 2 , " Should have uploaded files from `wwwroot`" )
74+ |> ignore
75+
5976 [<Test>]
6077 member this.StackExportsWebsiteUrl () =
61- let resources = runTest()
78+ let resources = runTest ()
6279 let stack = resources.OfType< WebsiteStack>() |> Seq.head
63-
80+
6481 let endpoint = getValue stack.Endpoint
65- endpoint.Should() .Be( " https://wwwprodsa.web.core.windows.net" , null ) |> ignore
82+
83+ ( endpoint :> obj) .Should() .Be( " https://wwwprodsa.web.core.windows.net" , null )
84+ |> ignore
0 commit comments