예제 #1
0
        public async Task FlushAfterAdd_PersistsEntity()
        {
            // Arrange
            var table = Mock.Of <TableClient>();
            TableEntityWriter <ITableEntity> product = new TableEntityWriter <ITableEntity>(table);
            const string partitionKey = "PK";
            const string rowKey       = "RK";
            TableEntity  entity       = new TableEntity(partitionKey, rowKey);

            product.Add(entity);
            // Act
            product.FlushAsync().GetAwaiter().GetResult();
            // Assert
            TableEntity persisted = await table.GetEntityAsync <TableEntity>(partitionKey, rowKey);

            Assert.NotNull(persisted);
        }
        public void FlushAfterAdd_PersistsEntity()
        {
            // Arrange
            IStorageAccount account = CreateFakeStorageAccount();
            IStorageTableClient client = account.CreateTableClient();
            IStorageTable table = client.GetTableReference("Table");

            TableEntityWriter<ITableEntity> product = new TableEntityWriter<ITableEntity>(table);
            const string partitionKey = "PK";
            const string rowKey = "RK";
            DynamicTableEntity entity = new DynamicTableEntity(partitionKey, rowKey);
            product.Add(entity);

            // Act
            product.FlushAsync().GetAwaiter().GetResult();

            // Assert
            DynamicTableEntity persisted = table.Retrieve<DynamicTableEntity>(partitionKey, rowKey);
            Assert.NotNull(persisted);
        }
예제 #3
0
        public void FlushAfterAdd_PersistsEntity()
        {
            // Arrange
            IStorageAccount     account = CreateFakeStorageAccount();
            IStorageTableClient client  = account.CreateTableClient();
            IStorageTable       table   = client.GetTableReference("Table");

            TableEntityWriter <ITableEntity> product = new TableEntityWriter <ITableEntity>(table);
            const string       partitionKey          = "PK";
            const string       rowKey = "RK";
            DynamicTableEntity entity = new DynamicTableEntity(partitionKey, rowKey);

            product.Add(entity);

            // Act
            product.FlushAsync().GetAwaiter().GetResult();

            // Assert
            DynamicTableEntity persisted = table.Retrieve <DynamicTableEntity>(partitionKey, rowKey);

            Assert.NotNull(persisted);
        }