@@ -4,6 +4,7 @@ namespace UnitTesting
4
4
5
5
open System
6
6
open System.Collections .Immutable
7
+ open System.Collections .Generic
7
8
open System.Threading .Tasks
8
9
open NUnit.Framework
9
10
open Pulumi
@@ -14,52 +15,70 @@ open FluentAssertions
14
15
15
16
[<TestFixture>]
16
17
type WebserverStackTests () =
17
- let runTest () : ImmutableArray < Resource > =
18
+ let runTest () : ImmutableArray < Resource > =
18
19
let options = new TestOptions( IsPreview = Nullable< bool> false )
20
+
19
21
Deployment.TestAsync< WebsiteStack>( new Mocks(), options)
20
22
|> Async.AwaitTask
21
23
|> Async.RunSynchronously
22
-
23
- let getValue ( output : Output < 'a >): 'a =
24
+
25
+ let getValue ( output : Output < 'a >) : 'a =
24
26
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
+
26
33
tcs.Task.Result
27
34
28
35
[<Test>]
29
36
member this.SingleResourceGroupExists () =
30
- let resources = runTest()
37
+ let resources = runTest ()
31
38
32
39
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
34
43
35
44
[<Test>]
36
45
member this.ResourceGroupHasEnvironmentTag () =
37
- let resources = runTest()
46
+ let resources = runTest ()
38
47
let resourceGroup = resources.OfType< ResourceGroup>() |> Seq.head
39
48
40
49
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
43
56
44
57
[<Test>]
45
58
member this.StorageAccountBelongsToResourceGroup () =
46
- let resources = runTest()
59
+ let resources = runTest ()
47
60
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
+
50
65
let resourceGroupName = getValue storageAccount.ResourceGroupName
51
- resourceGroupName.Should() .Be( " www-prod-rg" , null ) |> ignore
66
+ ( resourceGroupName :> obj ) .Should() .Be( " www-prod-rg" , null ) |> ignore
52
67
53
68
[<Test>]
54
69
member this.UploadsTwoFiles () =
55
- let resources = runTest()
70
+ let resources = runTest ()
56
71
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
+
59
76
[<Test>]
60
77
member this.StackExportsWebsiteUrl () =
61
- let resources = runTest()
78
+ let resources = runTest ()
62
79
let stack = resources.OfType< WebsiteStack>() |> Seq.head
63
-
80
+
64
81
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