1
+ using Amazon . DynamoDBv2 . Model ;
2
+ using DynamoDBGenerator . Attributes ;
3
+ using DynamoDBGenerator . Extensions ;
4
+
5
+ namespace DynamoDBGenerator . SourceGenerator . Tests . DynamoDBDocumentTests ;
6
+
7
+ [ DynamoDBMarshaller ( typeof ( ( Guid , Guid ) ) , PropertyName = "STRING" , ArgumentType = typeof ( string ) ) ]
8
+ [ DynamoDBMarshaller ( typeof ( ( Guid , Guid ) ) , PropertyName = "GUID" , ArgumentType = typeof ( Guid ) ) ]
9
+ [ DynamoDBMarshaller ( typeof ( ( Guid , Guid ) ) , PropertyName = "INT" , ArgumentType = typeof ( int ) ) ]
10
+ public partial class PrimitiveArgumentTests
11
+ {
12
+ [ Fact ]
13
+ public void ExpressionValueTracker_STRING_ShouldBeExpandedCorrectly ( )
14
+ {
15
+ IAttributeExpressionValueTracker < string > valueTracker = STRING . AttributeExpressionValueTracker ( ) ;
16
+ valueTracker . ToString ( ) . Should ( ) . Be ( ":p1" ) ;
17
+
18
+ valueTracker . AccessedValues ( "hello" ) . Should ( ) . BeEquivalentTo ( new Dictionary < string , AttributeValue >
19
+ {
20
+ { ":p1" , new AttributeValue { S = "hello" } }
21
+ } ) ;
22
+ }
23
+
24
+ [ Fact ]
25
+ public void ExpressionValueTracker_INT_ShouldBeExpandedCorrectly ( )
26
+ {
27
+ IAttributeExpressionValueTracker < int > valueTracker = INT . AttributeExpressionValueTracker ( ) ;
28
+ valueTracker . ToString ( ) . Should ( ) . Be ( ":p1" ) ;
29
+
30
+ valueTracker . AccessedValues ( 2 ) . Should ( ) . BeEquivalentTo ( new Dictionary < string , AttributeValue >
31
+ {
32
+ { ":p1" , new AttributeValue { N = "2" } }
33
+ } ) ;
34
+ }
35
+
36
+ [ Fact ]
37
+ public void ExpressionValueTracker_GUID_ShouldBeExpandedCorrectly ( )
38
+ {
39
+ IAttributeExpressionValueTracker < Guid > valueTracker = GUID . AttributeExpressionValueTracker ( ) ;
40
+ valueTracker . ToString ( ) . Should ( ) . Be ( ":p1" ) ;
41
+
42
+ var guid = Guid . NewGuid ( ) ;
43
+ valueTracker . AccessedValues ( guid ) . Should ( ) . BeEquivalentTo ( new Dictionary < string , AttributeValue >
44
+ {
45
+ { ":p1" , new AttributeValue { S = guid . ToString ( ) } }
46
+ } ) ;
47
+ }
48
+ }
0 commit comments