@@ -16,17 +16,43 @@ public partial class ToQueryRequestTests
16
16
17
17
public ToQueryRequestTests ( )
18
18
{
19
- _queryCatWithIdAndMinimumCuteness = CatMarshaller
19
+ var withKeyConditionExpression = CatMarshaller
20
20
. OnTable ( "TABLE" )
21
- . WithKeyConditionExpression ( ( x , y ) => $ "{ x . Id } = { y . Id } ")
21
+ . WithKeyConditionExpression ( ( x , y ) => $ "{ x . Id } = { y . Id } ") ;
22
+ _queryCatWithId = withKeyConditionExpression . ToQueryRequestBuilder ( ) ;
23
+
24
+ _queryCatWithIdAndMinimumCuteness = withKeyConditionExpression
22
25
. WithFilterExpression ( ( x , y ) => $ "{ x . Cuteness } > { y . MinimumCuteness } ")
23
26
. ToQueryRequestBuilder ( ) ;
24
27
}
25
28
26
29
private readonly QueryRequestBuilder < ( Guid Id , double MinimumCuteness ) > _queryCatWithIdAndMinimumCuteness ;
30
+ private readonly QueryRequestBuilder < ( Guid Id , double MinimumCuteness ) > _queryCatWithId ;
27
31
28
32
[ Fact ]
29
- public void Test ( )
33
+ public void Build_Request ( )
34
+ {
35
+ _fixture . CreateMany < ( Guid Id , double MinimumCuteness ) > ( 10 ) . Should ( ) . AllSatisfy ( tuple =>
36
+ {
37
+ var request = _queryCatWithId . Build ( tuple ) ;
38
+
39
+ request . TableName . Should ( ) . Be ( "TABLE" ) ;
40
+ request . ExpressionAttributeNames . Should ( ) . BeEquivalentTo ( new Dictionary < string , string >
41
+ {
42
+ { "#Id" , nameof ( Cat . Id ) }
43
+ } ) ;
44
+
45
+ request . ExpressionAttributeValues . Should ( ) . BeEquivalentTo ( new Dictionary < string , AttributeValue >
46
+ {
47
+ { ":p1" , new AttributeValue { S = tuple . Id . ToString ( ) } } ,
48
+ } ) ;
49
+
50
+ request . KeyConditionExpression . Should ( ) . Be ( "#Id = :p1" ) ;
51
+ } ) ;
52
+ }
53
+
54
+ [ Fact ]
55
+ public void Build_Request_FilterExpression ( )
30
56
{
31
57
_fixture . CreateMany < ( Guid Id , double MinimumCuteness ) > ( 10 ) . Should ( ) . AllSatisfy ( tuple =>
32
58
{
0 commit comments