/
DictionaryInvokeArgsTests.cs
47 lines (43 loc) 路 1.34 KB
/
DictionaryInvokeArgsTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2016-2021, Pulumi Corporation
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Xunit;
namespace Pulumi.Tests.Resources
{
public class DictionaryInvokeArgsTests
{
[Fact]
public void ConstructorValidValues()
{
try
{
var dict = new Dictionary<string, object?>
{
{ "null", null },
{ "string", "foo" },
{ "int", 123 },
{ "dictionary", new Dictionary<string, object?> { {"foo", "bar"} }.ToImmutableDictionary() },
{ "output", Output.CreateSecret("secret") },
};
var dictionary = new DictionaryInvokeArgs(dict.ToImmutableDictionary());
}
catch
{
Assert.True(false, "DictionaryInvokeArgs constructor should not throw an exception");
}
}
[Fact]
public void ConstructorInvalidValue()
{
var dict = new Dictionary<string, object?>
{
{ "arbitrary", new { Foo = "bar" } },
};
Assert.Throws<InvalidOperationException>(() =>
{
new DictionaryInvokeArgs(dict.ToImmutableDictionary());
});
}
}
}