-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNamespaceATests.cs
79 lines (71 loc) · 2.29 KB
/
NamespaceATests.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using Amazon.DynamoDBv2.Model;
using DynamoDBGenerator.Attributes;
namespace DynamoDBGenerator.SourceGenerator.Tests.Namespace.A;
public class NamespaceATests
{
[Fact]
public void Verify_Correct_NameType()
{
Container.ContainerMarshaller
.AttributeExpressionNameTracker()
.Should()
.BeOfType<A.Container.ContainerNames>();
Container.ContainerMarshaller
.AttributeExpressionNameTracker()
.PropertyA
.Should()
.BeOfType<A.Container.SampleClassNames>();
}
[Fact]
public void Verify_Correct_ValueType()
{
Container.ContainerMarshaller
.AttributeExpressionValueTracker()
.Should()
.BeOfType<A.Container.ContainerValues>();
Container.ContainerMarshaller
.AttributeExpressionValueTracker()
.PropertyA
.Should()
.BeOfType<A.Container.SampleClassValues>();
}
[Fact]
public void Unmarshall()
{
Container.ContainerMarshaller
.Unmarshall(new Dictionary<string, AttributeValue>
{
{
nameof(Container.PropertyA),
new AttributeValue
{
M = new Dictionary<string, AttributeValue>
{ { nameof(Container.PropertyA.Property), new AttributeValue { N = "2" } } }
}
}
})
.Should()
.BeEquivalentTo(new Container(new SampleClass(2)));
}
[Fact]
public void Marshall()
{
Container.ContainerMarshaller
.Marshall(new Container(new SampleClass(2)))
.Should()
.BeEquivalentTo(new Dictionary<string, AttributeValue>
{
{
nameof(Container.PropertyA),
new AttributeValue
{
M = new Dictionary<string, AttributeValue>
{ { nameof(Container.PropertyA.Property), new AttributeValue { N = "2" } } }
}
}
}
);
}
}
[DynamoDBMarshaller]
public partial record Container(SampleClass PropertyA);