Ejemplo n.º 1
0
        public void Upsert_ItemExistsAndIsThenUpdated_ItemIsProperlyUpdated()
        {
            var itemToUpsert = new TypeWithStringProperty
             {
            FirstType = "first"
             };

             _tableStorageProvider.Upsert( _tableName, itemToUpsert, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             _tableStorageProvider = new AzureTableStorageProvider( _storageAccount );
             itemToUpsert = new TypeWithStringProperty { FirstType = "second" };

             _tableStorageProvider.Upsert( _tableName, itemToUpsert, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

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

             Assert.AreEqual( itemToUpsert.FirstType, itemInTable.FirstType );
        }
Ejemplo n.º 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 );
        }