Ejemplo n.º 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
                );
        }
Ejemplo n.º 2
0
 public void AreEqual_Dictionary_WhenEquivalent(
     Dictionary <string, AttributeValue> x,
     Dictionary <string, AttributeValue> y
     )
 {
     AttributeValueAssert.AreEqual(x, y);
 }
Ejemplo n.º 3
0
 public void AreEqual_Null_WhenEqual([Values] bool value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         NULL = value
     },
         new AttributeValue {
         NULL = value
     }
         );
 }
Ejemplo n.º 4
0
 public void AreEqual_Numeric_WhenEqual(byte[] bytes)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         B = new MemoryStream(bytes)
     },
         new AttributeValue {
         B = new MemoryStream(bytes)
     }
         );
 }
Ejemplo n.º 5
0
 public void AreEqual_Boolean_WhenEqual([Values] bool value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         BOOL = value
     },
         new AttributeValue {
         BOOL = value
     }
         );
 }
Ejemplo n.º 6
0
 public void AreEqual_String_WhenEqual(string value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         S = value
     },
         new AttributeValue {
         S = value
     }
         );
 }
Ejemplo n.º 7
0
 public void AreEqual_Numeric_WhenEqual(string value)
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         N = value
     },
         new AttributeValue {
         N = value
     }
         );
 }
Ejemplo n.º 8
0
 public void AreEqual_BinarySet_WhenEquivalent(
     List <MemoryStream> x,
     List <MemoryStream> y
     )
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         BS = x
     },
         new AttributeValue {
         BS = y
     }
         );
 }
Ejemplo n.º 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
     }
         );
 }
Ejemplo n.º 10
0
 public void AreEqual_StringSet_WhenEquivalent(
     List <string> x,
     List <string> y
     )
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         SS = x
     },
         new AttributeValue {
         SS = y
     }
         );
 }
Ejemplo n.º 11
0
 public void AreEqual_List_WhenEquivalent(
     List <AttributeValue> x,
     List <AttributeValue> y
     )
 {
     AttributeValueAssert.AreEqual(
         new AttributeValue {
         L = x
     },
         new AttributeValue {
         L = y
     }
         );
 }
Ejemplo n.º 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)
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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")
                );
        }
Ejemplo n.º 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)
                );
        }
Ejemplo n.º 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")
                );
        }