public async Task Add_ItemWithPartitionKeyThatContainsInvalidCharacters_ThrowsDataServiceRequestException()
      {
         var item = new SimpleDataItem
         {
            FirstType = "a",
            SecondType = 1
         };

         string invalidPartitionKey = "/";
         _tableStorageProvider.Add( _tableName, item, invalidPartitionKey, _rowKey );
         await AsyncAssert.ThrowsAsync<DataServiceRequestException>( () => _tableStorageProvider.SaveAsync() );
      }
      public async Task Add_ItemWithPartitionKeyThatIsTooLong_ThrowsDataServiceRequestException()
      {
         var item = new SimpleDataItem
         {
            FirstType = "a",
            SecondType = 1
         };

         string partitionKeyThatIsLongerThan256Characters = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
         _tableStorageProvider.Add( _tableName, item, partitionKeyThatIsLongerThan256Characters, _rowKey );
         await AsyncAssert.ThrowsAsync<DataServiceRequestException>( () => _tableStorageProvider.SaveAsync() );
      }
Example #3
0
        public void SimpleItemConvertsToGenericEntityCorrectly()
        {
            var itemToSave = new SimpleDataItem
                          {
                             FirstType = "foo",
                             SecondType = "bar"
                          };

             var genericItemToTest = GenericEntity.HydrateFrom( itemToSave, "pk", "rk" );

             var wereCool = true;

             wereCool &= itemToSave.FirstType == genericItemToTest.GetProperties()["FirstType"].Value;
             wereCool &= itemToSave.SecondType == genericItemToTest.GetProperties()["SecondType"].Value;

             wereCool &= genericItemToTest.GetProperties().Count == 2;

             Assert.IsTrue( wereCool );
        }
        public static bool ComesBefore( this SimpleDataItem thisNode, IEnumerable<SimpleDataItem> listOfDataItems, SimpleDataItem laterNode )
        {
            int indexOfFirst = 0;
             int indexOfSecond = 0;

             int counter = 0;
             foreach ( var currentItemInIteration in listOfDataItems )
             {
            if ( currentItemInIteration.FirstType == thisNode.FirstType )
            {
               indexOfFirst = counter;
            }
            else if ( currentItemInIteration.FirstType == laterNode.FirstType )
            {
               indexOfSecond = counter;
            }
            counter++;
             }

             return indexOfFirst < indexOfSecond;
        }
Example #5
0
        public void SimpleItemConvertsToGenericTableEntityCorrectly()
        {
            var itemToSave = new SimpleDataItem
                          {
                             FirstType = "foo",
                             SecondType = 0
                          };

             TableItem tableItem = TableItem.Create( itemToSave, "pk", "rk" );

             var genericItemToTest = GenericTableEntity.HydrateFrom( tableItem );

             var wereCool = true;

             wereCool &= itemToSave.FirstType == genericItemToTest.WriteEntity( null )["FirstType"].StringValue;
             wereCool &= itemToSave.SecondType == genericItemToTest.WriteEntity( null )["SecondType"].Int32Value;
             wereCool &= null                  == genericItemToTest.WriteEntity( null )["UriTypeProperty"].StringValue;;

             wereCool &= genericItemToTest.WriteEntity( null ).Count == 3;

             Assert.IsTrue( wereCool );
        }
        public void SimpleItemConvertsToGenericTableEntityCorrectly()
        {
            var itemToSave = new SimpleDataItem
            {
                FirstType  = "foo",
                SecondType = 0
            };

            TableItem tableItem = TableItem.Create(itemToSave, "pk", "rk");

            var genericItemToTest = GenericTableEntity.HydrateFrom(tableItem);


            var wereCool = true;


            wereCool &= itemToSave.FirstType == genericItemToTest.WriteEntity(null)["FirstType"].StringValue;
            wereCool &= itemToSave.SecondType == genericItemToTest.WriteEntity(null)["SecondType"].Int32Value;
            wereCool &= null == genericItemToTest.WriteEntity(null)["UriTypeProperty"].StringValue;;

            wereCool &= genericItemToTest.WriteEntity(null).Count == 3;

            Assert.IsTrue(wereCool);
        }
        public void Get_AddItemToOneTableAndReadFromAnother_ItemIsNotReturnedFromSecondTable()
        {
            var simpleItem = new SimpleDataItem
             {
            FirstType = "first"
             };
             _tableStorageProvider.Add( _tableName, simpleItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             string differentTableName = "hash";
             _tableStorageProvider.Get<SimpleDataItem>( differentTableName, _partitionKey, _rowKey );

             Assert.Fail( "Should have thrown EntityDoesNotExistException." );
        }
        public void GetRangeByRowKey_OneItemInStore_EnumerableWithNoItemsReturned()
        {
            var item = new SimpleDataItem { FirstType = "a", SecondType = 1 };

             _tableStorageProvider.Add( _tableName, item, _partitionKey, "hithere" );
             _tableStorageProvider.Save();
             var result = _tableStorageProvider.GetRangeByRowKey<SimpleDataItem>( _tableName, _partitionKey, "hi", "hj" );

             Assert.AreEqual( 1, result.Count() );
        }
        private void EnsureOneItemInContext( TableStorageProvider tableStorageProvider )
        {
            var item = new SimpleDataItem
                    {
                       FirstType = "First",
                       SecondType = 2
                    };

             tableStorageProvider.Add( _tableName, item, _partitionKey, _rowKey );
             tableStorageProvider.Save();
        }
Example #10
0
        public void Upsert_UpsertAndCallingSaveAfterTryingToReadFromTheTable_ShouldActuallyInsert()
        {
            var simpleItem = new SimpleDataItem
             {
            FirstType = "first"
             };

             try
             {
            _tableStorageProvider.Get<SimpleDataItem>( _tableName, "DoNotCare", "DoNotCare" );
             }
             catch ( EntityDoesNotExistException )
             {
             }

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

             var actualDataItem = new InMemoryTableStorageProvider().Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( simpleItem.FirstType, actualDataItem.FirstType );
        }
Example #11
0
        public void AddItem_TwoMemoryContexts_ThePrimaryContextsUncommitedStoreShouldBeUnchangedWhenAnotherIsCreated()
        {
            InMemoryTableStorageProvider.ResetAllTables();
             var firstContext = new InMemoryTableStorageProvider();

             var expectedItem = new SimpleDataItem
                              {
                                 FirstType = "a",
                                 SecondType = 1
                              };

             firstContext.Add( _tableName, expectedItem, _partitionKey, _rowKey );
             firstContext.Save();

             new InMemoryTableStorageProvider();

             var item = firstContext.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( expectedItem.FirstType, item.FirstType );
             Assert.AreEqual( expectedItem.SecondType, item.SecondType );
        }
Example #12
0
        public void Upsert_MultipleItemsExist_UpdateSpecificItem()
        {
            var simpleItem = new SimpleDataItem
             {
            FirstType = "first"
             };

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

             simpleItem.FirstType = "second";
             _tableStorageProvider.Upsert( _tableName, simpleItem, "DONTCARE1", "DONTCARE2" );
             _tableStorageProvider.Save();

             simpleItem.FirstType = "third";
             _tableStorageProvider.Upsert( _tableName, simpleItem, "DONTCARE3", "DONTCARE4" );
             _tableStorageProvider.Save();

             simpleItem.FirstType = "fourth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, "DONTCARE5", "DONTCARE6" );
             _tableStorageProvider.Save();

             simpleItem.FirstType = "fifth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             var actualDataItem = _tableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( simpleItem.FirstType, actualDataItem.FirstType );
        }
Example #13
0
        public void Update_ItemDoesNotExist_ShouldThrowEntityDoesNotExistException()
        {
            var itemToUpdate = new SimpleDataItem
                            {
                               FirstType = "First",
                               SecondType = 2
                            };

             itemToUpdate.FirstType = "Do not care";

             _tableStorageProvider.Update( _tableName, itemToUpdate, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             Assert.Fail( "Should have thrown EntityDoesNotExistException" );
        }
Example #14
0
        public void Delete_ItemExistsAndTwoInstancesTryToDelete_ItemIsNotFoundInEitherCase()
        {
            var dataItem = new SimpleDataItem();
             _tableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             var firstTableStorageProvider = new InMemoryTableStorageProvider();
             var secondTableStorageProvider = new InMemoryTableStorageProvider();

             firstTableStorageProvider.Delete( _tableName, _partitionKey, _rowKey );
             firstTableStorageProvider.Save();
             secondTableStorageProvider.Delete( _tableName, _partitionKey, _rowKey );
             secondTableStorageProvider.Save();

             bool instanceOneExisted = false;
             bool instanceTwoExisted = false;

             try
             {
            firstTableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );
            instanceOneExisted = true;
             }
             catch ( EntityDoesNotExistException )
             {
             }

             try
             {
            secondTableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );
            instanceTwoExisted = true;
             }
             catch ( EntityDoesNotExistException )
             {
             }

             Assert.IsFalse( instanceOneExisted );
             Assert.IsFalse( instanceTwoExisted );
        }
Example #15
0
        public void Add_ItemWithRowKeyThatIsTooLong_ThrowsDataServiceRequestException()
        {
            var item = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };

             string rowKeyThatIsLongerThan256Characters = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
             _tableStorageProvider.Add( _tableName, item, _partitionKey, rowKeyThatIsLongerThan256Characters );
             _tableStorageProvider.Save();
        }
Example #16
0
        public void Add_ItemWithRowKeyThatContainsInvalidCharacters_ThrowsDataServiceRequestException()
        {
            var item = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };

             string invalidRowKey = "/";
             _tableStorageProvider.Add( _tableName, item, _partitionKey, invalidRowKey );
             _tableStorageProvider.Save();
        }
Example #17
0
        public void Add_ItemWithDuplicateRowAndPartitionKey_ThrowsEntityAlreadyExistsException()
        {
            var item = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };

             string rowKey = "rowkey";

             _tableStorageProvider.Add( _tableName, item, _partitionKey, rowKey );
             _tableStorageProvider.Save();

             _tableStorageProvider.Add( _tableName, item, _partitionKey, rowKey );
             _tableStorageProvider.Save();
        }
        public void Add_ItemIsAddedAndNotSaved_SameContextCanReadUnsavedItem()
        {
            var expectedItem = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };
             _tableStorageProvider.Add( _tableName, expectedItem, _partitionKey, _rowKey );

             var item = _tableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( expectedItem.FirstType, item.FirstType );
             Assert.AreEqual( expectedItem.SecondType, item.SecondType );
        }
Example #19
0
        public void Add_AddingToOneTableAndRetrievingFromAnother_ThrowsEntityDoesNotExistException()
        {
            var dataItem = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };
             _tableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );

             _tableStorageProvider.Get<SimpleDataItem>( "OtherTableName", _partitionKey, _rowKey );
        }
Example #20
0
        public void AddItem_TwoMemoryContexts_TheSecondContextWillSeeAddedAndSavedItem()
        {
            InMemoryTableStorageProvider.ResetAllTables();
             var firstTableStorageProvider = new InMemoryTableStorageProvider();
             var secondTableStorageProvider = new InMemoryTableStorageProvider();

             var expectedItem = new SimpleDataItem
                              {
                                 FirstType = "a",
                                 SecondType = 1
                              };

             firstTableStorageProvider.Add( _tableName, expectedItem, _partitionKey, _rowKey );
             firstTableStorageProvider.Save();

             var item = secondTableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( expectedItem.FirstType, item.FirstType );
             Assert.AreEqual( expectedItem.SecondType, item.SecondType );
        }
Example #21
0
        public void Get_OneItemInStore_HydratedItemIsReturned()
        {
            var dataItem = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };
             _tableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             Assert.AreEqual( dataItem.FirstType, _tableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey ).FirstType );
             Assert.AreEqual( dataItem.SecondType, _tableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey ).SecondType );
        }
Example #22
0
        public void Save_TwoTablesHaveBeenWrittenTo_ShouldSaveBoth()
        {
            var simpleItem = new SimpleDataItem
             {
            FirstType = "first"
             };

             _tableStorageProvider.Add( "firstTable", simpleItem, _partitionKey, _rowKey );

             _tableStorageProvider.Add( "secondTable", simpleItem, _partitionKey, _rowKey );

             _tableStorageProvider.Save();

             var itemOne = _tableStorageProvider.Get<SimpleDataItem>( "firstTable", _partitionKey, _rowKey );
             var itemTwo = _tableStorageProvider.Get<SimpleDataItem>( "secondTable", _partitionKey, _rowKey );

             Assert.AreEqual( simpleItem.FirstType, itemOne.FirstType );
             Assert.AreEqual( simpleItem.FirstType, itemTwo.FirstType );
        }
Example #23
0
        public void Delete_ItemExistsInAnotherInstancesTempStore_ItemIsNotDeleted()
        {
            var dataItem = new SimpleDataItem();
             var secondTableStorageProvider = new InMemoryTableStorageProvider();
             secondTableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );

             _tableStorageProvider.Delete( _tableName, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             secondTableStorageProvider.Save();

             var instance = secondTableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );
             Assert.IsNotNull( instance );
        }
Example #24
0
        public void Upsert_ExistingItemIsUpsertedInOneInstanceAndNotSaved_ShouldBeUnaffectedInOtherInstances()
        {
            var secondStorageProvider = new InMemoryTableStorageProvider();
             var item = new SimpleDataItem
                          {
                             FirstType = "first"
                          };

             _tableStorageProvider.Add( _tableName, item, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             item.FirstType = "second";
             _tableStorageProvider.Upsert( _tableName, item, _partitionKey, _rowKey );

             var result = secondStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( "first", result.FirstType );
        }
Example #25
0
        public void Delete_ManyItemsInTable_ItemsDeleted()
        {
            for ( var i = 0; i < 20; i++ )
             {
            var dataItem = new SimpleDataItem();

            _tableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey + i.ToString( CultureInfo.InvariantCulture ) );
            _tableStorageProvider.Save();
             }

             _tableStorageProvider.DeleteCollection( _tableName, _partitionKey );
             _tableStorageProvider.Save();

             var items = _tableStorageProvider.GetCollection<SimpleDataItem>( _tableName, _partitionKey );

             Assert.IsFalse( items.Any() );
        }
Example #26
0
        public void Upsert_MultipleUpsertsWithoutCallingSave_CallingGetThrowsEntityDoesNotExistException()
        {
            var simpleItem = new SimpleDataItem
             {
            FirstType = "first"
             };

             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );

             simpleItem.FirstType = "second";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );

             simpleItem.FirstType = "third";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );

             simpleItem.FirstType = "fourth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );

             simpleItem.FirstType = "fifth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );

             simpleItem.FirstType = "umpteenth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );

             var actualDataItem = _tableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( simpleItem.FirstType, actualDataItem.FirstType );
        }
Example #27
0
        public void GetCollection_ManyItemsInStore_ShouldBeRetreivedInProperSortedOrder()
        {
            var dataItem1 = new SimpleDataItem { FirstType = "a", SecondType = 1 };
             var dataItem2 = new SimpleDataItem { FirstType = "b", SecondType = 2 };
             var dataItem3 = new SimpleDataItem { FirstType = "c", SecondType = 3 };
             var dataItem4 = new SimpleDataItem { FirstType = "d", SecondType = 4 };

             _tableStorageProvider.Add( _tableName, dataItem1, _partitionKey, "3" );
             _tableStorageProvider.Add( _tableName, dataItem2, _partitionKey, "2" );
             _tableStorageProvider.Add( _tableName, dataItem3, _partitionKey, "1" );
             _tableStorageProvider.Add( _tableName, dataItem4, _partitionKey, "4" );
             _tableStorageProvider.Save();

             var listOfItems = _tableStorageProvider.GetCollection<SimpleDataItem>( _tableName, _partitionKey ).ToArray();

             Assert.IsTrue( dataItem3.ComesBefore( listOfItems, dataItem1 ), "Making sure item 3 comes before item 1." );
             Assert.IsTrue( dataItem3.ComesBefore( listOfItems, dataItem2 ), "Making sure item 3 comes before item 2." );
             Assert.IsTrue( dataItem3.ComesBefore( listOfItems, dataItem4 ), "Making sure item 3 comes before item 4." );

             Assert.IsTrue( dataItem2.ComesBefore( listOfItems, dataItem1 ), "Making sure item 2 comes before item 1." );
             Assert.IsTrue( dataItem2.ComesBefore( listOfItems, dataItem4 ), "Making sure item 2 comes before item 4." );

             Assert.IsTrue( dataItem1.ComesBefore( listOfItems, dataItem4 ), "Making sure item 1 comes before item 4." );
        }
Example #28
0
        public void Upsert_MultipleUpserts_UpdatesItem()
        {
            var simpleItem = new SimpleDataItem
             {
            FirstType = "first"
             };

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

             simpleItem.FirstType = "second";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             simpleItem.FirstType = "third";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             simpleItem.FirstType = "fourth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             simpleItem.FirstType = "fifth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             simpleItem.FirstType = "umpteenth";
             _tableStorageProvider.Upsert( _tableName, simpleItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             var actualDataItem = _tableStorageProvider.Get<SimpleDataItem>( _tableName, _partitionKey, _rowKey );

             Assert.AreEqual( simpleItem.FirstType, actualDataItem.FirstType );
        }
Example #29
0
        public void GetRangeByRowKey_ManyItemsInStore_EnumerableWithAppropriateItemsReturned()
        {
            var item1 = new SimpleDataItem { FirstType = "a", SecondType = 1 };
             var item2 = new SimpleDataItem { FirstType = "b", SecondType = 2 };
             var item3 = new SimpleDataItem { FirstType = "c", SecondType = 3 };
             var item4 = new SimpleDataItem { FirstType = "d", SecondType = 4 };

             _tableStorageProvider.Add( _tableName, item1, _partitionKey, "asdf" );
             _tableStorageProvider.Add( _tableName, item2, _partitionKey, "hithere" );
             _tableStorageProvider.Add( _tableName, item3, _partitionKey, "jklh" );
             _tableStorageProvider.Add( _tableName, item4, _partitionKey, "hi" );
             _tableStorageProvider.Save();

             var result = _tableStorageProvider.GetRangeByRowKey<SimpleDataItem>( _tableName, _partitionKey, "hi", "hj" );

             Assert.AreEqual( 2, result.Count() );
        }
Example #30
0
        public void Delete_ItemInTable_ItemDeleted()
        {
            var dataItem = new SimpleDataItem();

             _tableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             _tableStorageProvider.Delete( _tableName, _partitionKey, _rowKey );
             _tableStorageProvider.Save();

             var items = _tableStorageProvider.GetCollection<SimpleDataItem>( _tableName, _partitionKey );

             Assert.IsFalse( items.Any() );
        }
Example #31
0
 private void EnsureItemsInContext( TableStorageProvider tableStorageProvider, int count )
 {
     for ( int i = 0; i < count; i++ )
      {
     var item = new SimpleDataItem
                {
                   FirstType = i.ToString( CultureInfo.InvariantCulture ),
                   SecondType = i
                };
     tableStorageProvider.Add( _tableName, item, _partitionKey, _rowKey + i );
      }
      tableStorageProvider.Save();
 }