public void TestContext() { // It is a known bug that this test currently fails due to an AOT-compilation // issue, on iOS using mono2x. foreach (var conversion in new DynamoDBEntryConversion [] { DynamoDBEntryConversion.V1, DynamoDBEntryConversion.V2 }) { TableCache.Clear(); // Cleanup existing data CleanupTables(); // Recreate context CreateContext(conversion); TestEnumHashKeyObjects(); TestEmptyCollections(conversion); TestContextConversions(); TestUnsupportedTypes(); TestEnums(conversion); TestHashObjects(); TestHashRangeObjects(); TestOtherContextOperations(); TestBatchOperations(); } }
public void TestContext() { foreach (var conversion in new DynamoDBEntryConversion [] { DynamoDBEntryConversion.V1, DynamoDBEntryConversion.V2 }) { TableCache.Clear(); // Cleanup existing data CleanupTables(); // Recreate context CreateContext(conversion); TestEnumHashKeyObjects(); TestEmptyCollections(conversion); TestContextConversions(); TestUnsupportedTypes(); TestEnums(conversion); TestHashObjects(); TestHashRangeObjects(); TestOtherContextOperations(); TestBatchOperations(); } }
public void TestContext() { Client.BeforeRequestEvent += ClientBeforeRequestEvent; try { foreach (var conversion in new DynamoDBEntryConversion[] { DynamoDBEntryConversion.V1, DynamoDBEntryConversion.V2 }) { TableCache.Clear(); // Cleanup existing data CleanupTables(); // Recreate context CreateContext(conversion); TestEmptyCollections(conversion); TestContextConversions(); TestUnsupportedTypes(); TestHashObjects(); TestHashRangeObjects(); TestOtherContextOperations(); TestBatchOperations(); } } finally { Client.BeforeRequestEvent -= ClientBeforeRequestEvent; } }
private void LoadTables(DynamoDBEntryConversion conversion, out Table hashTable, out Table hashRangeTable, out Table numericHashRangeTable) { TableCache.Clear(); using (var counter = CountServiceResponses(Client)) { // Load table using TryLoadTable API hashTable = null; Assert.IsFalse(Table.TryLoadTable(Client, "FakeHashTableThatShouldNotExist", conversion, out hashTable)); Assert.AreEqual(0, counter.ResponseCount); Assert.IsTrue(Table.TryLoadTable(Client, hashTableName, conversion, out hashTable)); Assert.AreEqual(1, counter.ResponseCount); Assert.IsNotNull(hashTable); Assert.AreEqual(hashTableName, hashTable.TableName); Assert.AreEqual(3, hashTable.Attributes.Count); Assert.AreEqual(1, hashTable.GlobalSecondaryIndexes.Count); Assert.AreEqual(1, hashTable.GlobalSecondaryIndexes["GlobalIndex"].ProvisionedThroughput.ReadCapacityUnits); Assert.AreEqual(1, hashTable.GlobalSecondaryIndexNames.Count); Assert.AreEqual(1, hashTable.HashKeys.Count); Assert.AreEqual(0, hashTable.RangeKeys.Count); Assert.AreEqual(1, hashTable.Keys.Count); Assert.AreEqual(0, hashTable.LocalSecondaryIndexes.Count); Assert.AreEqual(0, hashTable.LocalSecondaryIndexNames.Count); // Load table using LoadTable API (may throw an exception) AssertExtensions.ExpectException(() => Table.LoadTable(Client, "FakeHashRangeTableThatShouldNotExist", conversion)); Assert.AreEqual(1, counter.ResponseCount); hashRangeTable = Table.LoadTable(Client, hashRangeTableName, conversion); Assert.AreEqual(2, counter.ResponseCount); Assert.IsNotNull(hashRangeTable); Assert.AreEqual(hashRangeTableName, hashRangeTable.TableName); Assert.AreEqual(5, hashRangeTable.Attributes.Count); Assert.AreEqual(1, hashRangeTable.GlobalSecondaryIndexes.Count); Assert.AreEqual(1, hashRangeTable.GlobalSecondaryIndexes["GlobalIndex"].ProvisionedThroughput.ReadCapacityUnits); Assert.AreEqual(1, hashRangeTable.GlobalSecondaryIndexNames.Count); Assert.AreEqual(1, hashRangeTable.HashKeys.Count); Assert.AreEqual(1, hashRangeTable.RangeKeys.Count); Assert.AreEqual(2, hashRangeTable.Keys.Count); Assert.AreEqual(1, hashRangeTable.LocalSecondaryIndexes.Count); Assert.AreEqual(2, hashRangeTable.LocalSecondaryIndexes["LocalIndex"].KeySchema.Count); Assert.AreEqual(1, hashRangeTable.LocalSecondaryIndexNames.Count); numericHashRangeTable = Table.LoadTable(Client, numericHashRangeTableName, conversion); Assert.AreEqual(1, numericHashRangeTable.HashKeys.Count); Assert.AreEqual(1, numericHashRangeTable.RangeKeys.Count); Assert.AreEqual(2, numericHashRangeTable.Keys.Count); Assert.IsTrue(numericHashRangeTable.Keys.ContainsKey("CreationTime")); Assert.IsTrue(numericHashRangeTable.Keys.ContainsKey("Name")); } }