コード例 #1
0
        public async Task UpdateDynamic_TheDynamicAlreadyInsertedAndNeedsToBeUpdated_DynamicIsReturnedWithAllProperties()
        {
            dynamic dyn = new ExpandoObject();

            dyn.FirstItem  = "this is the first item.";
            dyn.SecondItem = 2;

            _tableStorageProvider.Add(_tableName, dyn, "pk", "rk");
            await _tableStorageProvider.SaveAsync();

            dyn.FirstItem = "this text is changed.";
            _tableStorageProvider.Update(_tableName, dyn, "pk", "rk");
            await _tableStorageProvider.SaveAsync();

            var result = await _tableStorageProvider.GetAsync(_tableName, "pk", "rk");

            Assert.AreEqual("this text is changed.", result.FirstItem);
            Assert.AreEqual(2, result.SecondItem);
        }
コード例 #2
0
        public void Update_ItemExistsAndUpdateIsValid_ShouldPerformTheUpdate()
        {
            EnsureOneItemInTableStorage();

             var itemToUpdate = _tableStorageProvider.Get<TypeWithStringProperty>( _tableName, _partitionKey, _rowKey );

             string updatedFirstTypeValue = "I am updated";
             itemToUpdate.FirstType = updatedFirstTypeValue;

             _tableStorageProvider = new AzureTableStorageProvider( _storageAccount );
             _tableStorageProvider.Update( _tableName, itemToUpdate, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             var updatedItem = _tableStorageProvider.Get<TypeWithStringProperty>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( updatedFirstTypeValue, updatedItem.FirstType );
        }