public async Task AddItem_TwoMemoryContexts_ThePrimaryContextsUncommitedStoreShouldBeUnchangedWhenAnotherIsCreated()
      {
         InMemoryTableStorageProvider.ResetAllTables();
         var firstContext = new InMemoryTableStorageProvider();

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

         firstContext.Add( _tableName, expectedItem, _partitionKey, _rowKey );
         await firstContext.SaveAsync();

         new InMemoryTableStorageProvider();

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

         Assert.AreEqual( expectedItem.FirstType, item.FirstType );
         Assert.AreEqual( expectedItem.SecondType, item.SecondType );
      }
      public async Task AddItem_TwoMemoryContexts_TheSecondContextWillNotSeeAddedAndSavedItem_WithInstanceAccount()
      {
         InMemoryTableStorageProvider.ResetAllTables();
         var firstTableStorageProvider = new InMemoryTableStorageProvider( new MemoryStorageAccount() );
         var secondTableStorageProvider = new InMemoryTableStorageProvider( new MemoryStorageAccount() );

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

         firstTableStorageProvider.Add( _tableName, expectedItem, _partitionKey, _rowKey );
         await firstTableStorageProvider.SaveAsync();

         bool hasThrown = false;
         try
         {
            await secondTableStorageProvider.GetAsync<SimpleDataItem>( _tableName, _partitionKey, _rowKey );
         }
         catch ( EntityDoesNotExistException )
         {
            hasThrown = true;
         }

         Assert.IsTrue( hasThrown );
      }
      public async Task Delete_ItemExistsAndTwoInstancesTryToDelete_ItemIsNotFoundInEitherCase()
      {
         var dataItem = new SimpleDataItem();
         _tableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );
         await _tableStorageProvider.SaveAsync();

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

         firstTableStorageProvider.Delete( _tableName, _partitionKey, _rowKey );
         await firstTableStorageProvider.SaveAsync();
         secondTableStorageProvider.Delete( _tableName, _partitionKey, _rowKey );
         await secondTableStorageProvider.SaveAsync();


         bool instanceOneExisted = false;
         bool instanceTwoExisted = false;

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

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

         Assert.IsFalse( instanceOneExisted );
         Assert.IsFalse( instanceTwoExisted );
      }
      public async Task 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 );
         await firstTableStorageProvider.SaveAsync();

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

         Assert.AreEqual( expectedItem.FirstType, item.FirstType );
         Assert.AreEqual( expectedItem.SecondType, item.SecondType );
      }
      public async Task Delete_ItemExistsInAnotherInstancesTempStore_ItemIsNotDeleted()
      {
         var dataItem = new SimpleDataItem();
         var secondTableStorageProvider = new InMemoryTableStorageProvider();
         secondTableStorageProvider.Add( _tableName, dataItem, _partitionKey, _rowKey );

         _tableStorageProvider.Delete( _tableName, _partitionKey, _rowKey );
         await _tableStorageProvider.SaveAsync();

         await secondTableStorageProvider.SaveAsync();

         var instance = await secondTableStorageProvider.GetAsync<SimpleDataItem>( _tableName, _partitionKey, _rowKey );
         Assert.IsNotNull( instance );
      }