1
1
using DynamoDBGenerator . Attributes ;
2
2
namespace DynamoDBGenerator . SourceGenerator . Tests . DynamoDBDocumentTests ;
3
3
4
+
4
5
[ DynamoDBMarshaller ( EntityType = typeof ( Person ) , ArgumentType = typeof ( ( string firstName , DateTime timeStamp ) ) , AccessName = "PersonWithTupleArgument" ) ]
5
6
[ DynamoDBMarshaller ( EntityType = typeof ( Person ) ) ]
6
7
[ DynamoDBMarshaller ( EntityType = typeof ( SelfReferencingClass ) ) ]
@@ -22,12 +23,12 @@ public void PersonWithTupleArgument_AccessingRootExpressionAttributeValue_Should
22
23
{
23
24
var valueTracker = PersonWithTupleArgument . AttributeExpressionValueTracker ( ) ;
24
25
var tracker = valueTracker as IAttributeExpressionValueTracker < ( string firstName , DateTime timeStamp ) > ;
25
-
26
+
26
27
var act = ( ) => valueTracker . ToString ( ) ;
27
28
act . Should ( ) . NotThrow ( ) ;
28
29
tracker . ToString ( ) . Should ( ) . Be ( ":p1" ) ;
29
30
}
30
-
31
+
31
32
[ Fact ]
32
33
public void PersonWithTupleArgument_AccessingNestedExpressionAttributeName_ShouldNotThrow ( )
33
34
{
@@ -38,7 +39,7 @@ public void PersonWithTupleArgument_AccessingNestedExpressionAttributeName_Shoul
38
39
act . Should ( ) . NotThrow ( ) ;
39
40
nameTracker . Address . ToString ( ) . Should ( ) . Be ( "#Address" ) ;
40
41
}
41
-
42
+
42
43
[ Fact ]
43
44
public void PersonWithTupleArgument_Tuple_CanBeParameterized ( )
44
45
{
@@ -64,6 +65,24 @@ public void PersonWithTupleArgument_Tuple_CanBeParameterized()
64
65
} ) ;
65
66
}
66
67
68
+
69
+ [ Fact ]
70
+ public void SelfReference_AttributeNames_EnsureUniquness ( )
71
+ {
72
+ var nametracker = SelfReferencingClassMarshaller . AttributeExpressionNameTracker ( ) ;
73
+ var field1 = nametracker . Self . Self . Self . Self . Field1 ;
74
+ var field2 = nametracker . Self . Self . Self . Field2 ;
75
+
76
+ ( nametracker as IAttributeExpressionNameTracker )
77
+ . AccessedNames ( )
78
+ . Should ( )
79
+ . BeEquivalentTo ( new KeyValuePair < string , string > [ ] {
80
+ new KeyValuePair < string , string > ( "#Self" , "Self" ) ,
81
+ new KeyValuePair < string , string > ( "#Field1" , "Field1" ) ,
82
+ new KeyValuePair < string , string > ( "#Field2" , "Field2" )
83
+ } ) ;
84
+ }
85
+
67
86
[ Theory ]
68
87
[ InlineData ( 5 ) ]
69
88
[ InlineData ( 10 ) ]
@@ -187,7 +206,7 @@ int count
187
206
188
207
public class InheritedClass : ClassWithOverriddenAttributeName
189
208
{
190
-
209
+
191
210
}
192
211
193
212
public class ClassWithOverriddenAttributeName
0 commit comments