Пример #1
0
        private async Task TestPutGet()
        {
            // Clear tables
            await SharedTestFixture.CleanupTables();

            Table hashTable;
            Table hashRangeTable;

            // Load tables using provided conversion schema
            LoadTables(DynamoDBEntryConversion.V2, out hashTable, out hashRangeTable);

            // JSON as top-level data
            var doc = Document.FromJson(sampleJson);
            await hashRangeTable.PutItemAsync(doc);

            var retrievedDoc = await hashRangeTable.GetItemAsync("Alan", 31);

            Assert.True(doc.Equals(retrievedDoc));

            // JSON as nested data
            var nestedDoc = Document.FromJson(sampleJson);

            doc              = new Document();
            doc["Name"]      = "Jim";
            doc["Age"]       = 29;
            doc["Colleague"] = nestedDoc;
            await hashRangeTable.PutItemAsync(doc);

            retrievedDoc = await hashRangeTable.GetItemAsync("Jim", 29);

            Assert.True(doc.ForceConversion(DynamoDBEntryConversion.V2).Equals(retrievedDoc));
        }
Пример #2
0
        public async Task 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 })
            {
                SharedTestFixture.TableCache.Clear();

                // Cleanup existing data
                await SharedTestFixture.CleanupTables();

                // Recreate context
                SharedTestFixture.CreateContext(conversion);

                await TestEnumHashKeyObjects();

                await TestEmptyCollections(conversion);

                TestContextConversions();
                await TestUnsupportedTypes();

                TestEnums(conversion);

                await TestHashObjects();
                await TestHashRangeObjects();
                await TestOtherContextOperations();
                await TestBatchOperations();
            }
        }
Пример #3
0
        public async Task TestTableOperations()
        {
            foreach (var conversion in new DynamoDBEntryConversion[] { DynamoDBEntryConversion.V1, DynamoDBEntryConversion.V2 })
            {
                // Clear tables
                await SharedTestFixture.CleanupTables();

                Table hashTable;
                Table hashRangeTable;

                // Load tables using provided conversion schema
                LoadTables(conversion, out hashTable, out hashRangeTable);

                // Test saving and loading empty lists and maps
                await TestEmptyCollections(hashTable);

                // Test operations on hash-key table
                await TestHashTable(hashTable, conversion);

                // Test operations on hash-and-range-key table
                await TestHashRangeTable(hashRangeTable, conversion);

                // Test large batch writes and gets
                await TestLargeBatchOperations(hashTable);

                // Test expressions for update
                await TestExpressionUpdate(hashTable);

                // Test expressions for put
                await TestExpressionPut(hashTable);

                // Test expressions for delete
                await TestExpressionsOnDelete(hashTable);

                // Test expressions for query
                await TestExpressionsOnQuery(hashRangeTable);

                // Test expressions for scan
                await TestExpressionsOnScan(hashRangeTable);

                // Test Query and Scan manual pagination
                await TestPagination(hashRangeTable);
            }
        }