コード例 #1
0
        public static async Task AssertItemAsync(
            this IAmazonDynamoDB db,
            string tableName,
            Dictionary <string, AttributeValue> key,
            Dictionary <string, AttributeValue> expectedItem
            )
        {
            GetItemRequest request = new GetItemRequest {
                TableName      = tableName,
                Key            = key,
                ConsistentRead = true
            };

            GetItemResponse response = await db
                                       .GetItemAsync(request)
                                       .ConfigureAwait(false);

            if (!response.IsItemSet)
            {
                Assert.Fail("Item should exist.");
            }

            AttributeValueAssert.AreEqual(
                actual: response.Item,
                expected: expectedItem
                );
        }
コード例 #2
0
 public void AreEqual_Dictionary_WhenEquivalent(
     Dictionary <string, AttributeValue> x,
     Dictionary <string, AttributeValue> y
     )
 {
     AttributeValueAssert.AreEqual(x, y);
 }
コード例 #3
0
 public void AreEqual_Null_WhenEqual([Values] bool value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         NULL = value
     },
         new AttributeValue {
         NULL = value
     }
         );
 }
コード例 #4
0
 public void AreEqual_Numeric_WhenEqual(byte[] bytes)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         B = new MemoryStream(bytes)
     },
         new AttributeValue {
         B = new MemoryStream(bytes)
     }
         );
 }
コード例 #5
0
 public void AreEqual_Boolean_WhenEqual([Values] bool value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         BOOL = value
     },
         new AttributeValue {
         BOOL = value
     }
         );
 }
コード例 #6
0
 public void AreEqual_String_WhenEqual(string value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         S = value
     },
         new AttributeValue {
         S = value
     }
         );
 }
コード例 #7
0
 public void AreEqual_Numeric_WhenEqual(string value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         N = value
     },
         new AttributeValue {
         N = value
     }
         );
 }
コード例 #8
0
 public void AreEqual_BinarySet_WhenEquivalent(
     List <MemoryStream> x,
     List <MemoryStream> y
     )
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         BS = x
     },
         new AttributeValue {
         BS = y
     }
         );
 }
コード例 #9
0
 public void AreEqual_Map_WhenEquivalent(
     Dictionary <string, AttributeValue> x,
     Dictionary <string, AttributeValue> y
     )
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         M = x
     },
         new AttributeValue {
         M = y
     }
         );
 }
コード例 #10
0
 public void AreEqual_StringSet_WhenEquivalent(
     List <string> x,
     List <string> y
     )
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         SS = x
     },
         new AttributeValue {
         SS = y
     }
         );
 }
コード例 #11
0
 public void AreEqual_List_WhenEquivalent(
     List <AttributeValue> x,
     List <AttributeValue> y
     )
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         L = x
     },
         new AttributeValue {
         L = y
     }
         );
 }
コード例 #12
0
        public void AreEqual_Dictionary_WhenNotEqual(
            Dictionary <string, AttributeValue> x,
            Dictionary <string, AttributeValue> y,
            string expectedMessage
            )
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(x, y);
            });

            Assert.That(
                err.Message,
                Does.StartWith(expectedMessage)
                );
        }
コード例 #13
0
        public void AreEqual_Null_WhenNotEqual()
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    NULL = true
                },
                    new AttributeValue {
                    NULL = false
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  NULL must be equal")
                );
        }
コード例 #14
0
        public void AreEqual_Numeric_WhenNotEqual(string x, string y)
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    N = "33"
                },
                    new AttributeValue {
                    N = "45"
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  N must be equal")
                );
        }
コード例 #15
0
        public void AreEqual_String_WhenNotEqual()
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    S = "x"
                },
                    new AttributeValue {
                    S = "y"
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  S must be equal")
                );
        }
コード例 #16
0
        public void AreEqual_Boolean_WhenBooleanNotSet()
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    BOOL = true
                },
                    new AttributeValue {
                    S = "abc"
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  IsBOOLSet must be equal")
                );
        }
コード例 #17
0
        public void AreEqual_Numeric_WhenNotEqual(
            byte[] x,
            byte[] y
            )
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    B = new MemoryStream(x)
                },
                    new AttributeValue {
                    B = new MemoryStream(y)
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  B must be equal")
                );
        }
コード例 #18
0
        public void AreEqual_BinarySet_WhenNotEqual(
            List <MemoryStream> x,
            List <MemoryStream> y
            )
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    BS = x
                },
                    new AttributeValue {
                    BS = y
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  BS must be equivalent")
                );
        }
コード例 #19
0
        public void AreEqual_StringSet_WhenNotEqual(
            List <string> x,
            List <string> y
            )
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    SS = x
                },
                    new AttributeValue {
                    SS = y
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  SS must be equivalent")
                );
        }
コード例 #20
0
        public void AreEqual_Map_WhenMapNotSet()
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    M = new Dictionary <string, AttributeValue> {
                        { "x", new AttributeValue {
                              N = "23.88"
                          } }
                    }
                },
                    new AttributeValue {
                    S = "abc"
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  IsMSet must be equal")
                );
        }
コード例 #21
0
        public void AreEqual_List_WhenNotEqual(
            List <AttributeValue> x,
            List <AttributeValue> y,
            string expectedMessage
            )
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    L = x
                },
                    new AttributeValue {
                    L = y
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith(expectedMessage)
                );
        }
コード例 #22
0
        public void AreEqual_List_WhenListNotSet()
        {
            var err = Assert.Throws <AssertionException>(() => {
                AttributeValueAssert.AreEqual(
                    new AttributeValue {
                    L = new List <AttributeValue> {
                        new AttributeValue {
                            N = "23.88"
                        }
                    }
                },
                    new AttributeValue {
                    S = "abc"
                }
                    );
            });

            Assert.That(
                err.Message,
                Does.StartWith("  IsLSet must be equal")
                );
        }