1
1
using Amazon . DynamoDBv2 . Model ;
2
2
using DynamoDBGenerator . Attributes ;
3
+ using DynamoDBGenerator . Extensions ;
3
4
4
5
namespace DynamoDBGenerator . SourceGenerator . Tests . DynamoDBDocumentTests ;
5
6
6
- [ DynamoDBMarshaller ( typeof ( ( Guid , Guid ) ) , PropertyName = "PrimitiveArgument" , ArgumentType = typeof ( string ) ) ]
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 ) ) ]
7
10
public partial class PrimitiveArgumentTests
8
11
{
9
12
[ Fact ]
10
- public void ExpressionValueTracker_String_ShouldBeExpandedCorrectly ( )
13
+ public void ExpressionValueTracker_STRING_ShouldBeExpandedCorrectly ( )
11
14
{
12
- IAttributeExpressionValueTracker < string > valueTracker = PrimitiveArgument . AttributeExpressionValueTracker ( ) ;
15
+ IAttributeExpressionValueTracker < string > valueTracker = STRING . AttributeExpressionValueTracker ( ) ;
13
16
valueTracker . ToString ( ) . Should ( ) . Be ( ":p1" ) ;
14
17
15
18
valueTracker . AccessedValues ( "hello" ) . Should ( ) . BeEquivalentTo ( new Dictionary < string , AttributeValue >
16
19
{
17
20
{ ":p1" , new AttributeValue { S = "hello" } }
18
21
} ) ;
19
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
+ }
20
48
}
0 commit comments