Exemplo n.º 1
0
      public async Task ResetAllTables_ContextCreatedBeforeCallingReset_ExistingContextStillWorks()
      {
         var localContext = new MemoryTableContext();
         MemoryTableContext.ResetAllTables();
         _context = new MemoryTableContext();

         var item = new DecoratedItem
         {
            Id = "abc",
            Name = "123",
            Age = 50
         };
         var entity = TableItem.Create( item );
         _context.AddNewItem( "table", entity );
         await _context.SaveAsync( Execute.Individually );


         var returnedItem = (await localContext.CreateQuery<DecoratedItem>( "table" ).PartitionKeyEquals( "abc" ).RowKeyEquals( "123" ).Async() ).Single();
         Assert.AreEqual( item.Id, returnedItem.Id );
         Assert.AreEqual( item.Name, returnedItem.Name );
         Assert.AreEqual( item.Age, returnedItem.Age );
      }
Exemplo n.º 2
0
 public void Initialize()
 {
     MemoryTableContext.ResetAllTables();
      _context = new MemoryTableContext();
 }
Exemplo n.º 3
0
        public void GetItem_ItemAddedAndSavedWithDifferentContext_ReturnsItem()
        {
            var addedItem = new DecoratedItem { Id = "abc", Name = "123", Age = 50 };
             var entity = TableItem.Create( addedItem );
             _context.AddNewItem( "table", entity );
             _context.Save( Execute.Individually );

             var returnedItem = new MemoryTableContext().GetItem<DecoratedItem>( "table", "abc", "123" );
             Assert.AreEqual( addedItem.Id, returnedItem.Id );
             Assert.AreEqual( addedItem.Name, returnedItem.Name );
             Assert.AreEqual( addedItem.Age, returnedItem.Age );
        }
Exemplo n.º 4
0
 public void Initialize()
 {
     MemoryTableContext.ResetAllTables();
      _context = new MemoryTableContext( new MemoryStorageAccount() );
 }
Exemplo n.º 5
0
 public static void ResetAllTables()
 {
     MemoryTableContext.ResetAllTables();
 }