Пример #1
0
        public void CreateDynamoDbIfDoesNotExist()
        {
            DynamoDbConfig config = GetDynamoDbConfig();
            DynamoTable table = new DynamoTable(config, _client);

            table.CreateIfNotExist();

            AssertDynamoDbExists(_tableName);
        }
Пример #2
0
        public void CanHandleConcurrentCalls()
        {
            DynamoDbConfig config = GetDynamoDbConfig();

            var table = new DynamoTable(config, _client);
            var tasks = Enumerable.Repeat(Task.Factory.StartNew(table.CreateIfNotExist), 10);
            Task.WaitAll(tasks.ToArray());

            AssertDynamoDbExists(_tableName);
        }
        public void CanReadAndWriteData()
        {
            var client = new AmazonDynamoDBClient(RegionEndpoint.EUWest1);
            const string itemId = "1";
            var provider = new DynamoStore(new DynamoDBContext(client));
            var config = GetDynamoDbConfig();
            var table = new DynamoTable(config, client);

            table.CreateIfNotExist();

            provider.Save(new FakeDynamoItem { Id = itemId }, new DynamoDBOperationConfig());
            var result = provider.Read<FakeDynamoItem>(itemId, new DynamoDBOperationConfig());

            Assert.IsNotNull(result);
            Console.WriteLine(result.Id);
            Assert.AreEqual(result.Id, itemId);
        }