コード例 #1
0
        public async Task GetAsync_ObjectInsertedIsInheritsDynamicObject_RetrievedProperly()
        {
            dynamic item = new DynamicPropertyBag();

            item.Foo = "test";
            item.Bar = 1;

            string partitionKey = "partitionKey";
            string rowKey       = "rowKey";

            _tableStorageProvider.Add(_tableName, item, partitionKey, rowKey);
            await _tableStorageProvider.SaveAsync();

            dynamic result = await _tableStorageProvider.GetAsync(_tableName, partitionKey, rowKey);

            Assert.AreEqual(item.Foo, result.Foo);
            Assert.AreEqual(item.Bar, result.Bar);
        }
コード例 #2
0
        public async Task AddItem_TypeWithSingleStringProperty_ItemAddedToStore()
        {
            var dataItem = new TypeWithStringProperty
            {
                FirstType = "b"
            };

            _tableStorageProvider.Add(_tableName, dataItem, _partitionKey, _rowKey);
            await _tableStorageProvider.SaveAsync();

            var result = await _tableStorageProvider.GetAsync <TypeWithStringProperty>(_tableName, _partitionKey, _rowKey);

            Assert.AreEqual("b", result.FirstType);
        }
コード例 #3
0
      public async Task Upsert_ItemExistsAndIsThenUpdated_ItemIsProperlyUpdated()
      {
         var itemToUpsert = new TypeWithStringProperty
         {
            FirstType = "first"
         };

         _tableStorageProvider.Upsert( _tableName, itemToUpsert, _partitionKey, _rowKey );
         await _tableStorageProvider.SaveAsync();

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

         _tableStorageProvider.Upsert( _tableName, itemToUpsert, _partitionKey, _rowKey );
         await _tableStorageProvider.SaveAsync();

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

         Assert.AreEqual( itemToUpsert.FirstType, itemInTable.FirstType );
      }
コード例 #4
0
      public async Task Update_ItemExistsAndUpdateIsValid_ShouldPerformTheUpdate()
      {
         await EnsureOneItemInTableStorageAsync();

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

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

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

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

         Assert.AreEqual( updatedFirstTypeValue, updatedItem.FirstType );
      }
コード例 #5
0
ファイル: HashRepositoryTests.cs プロジェクト: Zero-GHub/hyde
 public Task <Hash> GetHash(string hashUrl)
 {
     return(_tableStorageProvider.GetAsync <Hash>(string.Empty, _hashPartitionKey, hashUrl));
 }