當前位置: 首頁>>代碼示例>>C#>>正文


C# Test.SimpleDataItem類代碼示例

本文整理匯總了C#中TechSmith.Hyde.Test.SimpleDataItem的典型用法代碼示例。如果您正苦於以下問題:C# SimpleDataItem類的具體用法?C# SimpleDataItem怎麽用?C# SimpleDataItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SimpleDataItem類屬於TechSmith.Hyde.Test命名空間,在下文中一共展示了SimpleDataItem類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Add_ItemWithPartitionKeyThatContainsInvalidCharacters_ThrowsDataServiceRequestException

      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() );
      }
開發者ID:TechSmith,項目名稱:hyde,代碼行數:12,代碼來源:TableStorageProviderTests.cs

示例2: Add_ItemWithPartitionKeyThatIsTooLong_ThrowsDataServiceRequestException

      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() );
      }
開發者ID:TechSmith,項目名稱:hyde,代碼行數:12,代碼來源:TableStorageProviderTests.cs

示例3: SimpleItemConvertsToGenericEntityCorrectly

        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 );
        }
開發者ID:tonylambert,項目名稱:hyde,代碼行數:19,代碼來源:GenericEntityTests.cs

示例4: ComesBefore

        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;
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:21,代碼來源:TableStorageProviderTests.cs

示例5: SimpleItemConvertsToGenericTableEntityCorrectly

        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 );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:22,代碼來源:GenericTableEntityTests.cs

示例6: GetRangeByRowKey_OneItemInStore_EnumerableWithNoItemsReturned

        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() );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:10,代碼來源:TableStorageProviderTests.cs

示例7: Get_AddItemToOneTableAndReadFromAnother_ItemIsNotReturnedFromSecondTable

        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." );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:14,代碼來源:TableStorageProviderTests.cs

示例8: Upsert_UpsertAndCallingSaveAfterTryingToReadFromTheTable_ShouldActuallyInsert

        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 );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:22,代碼來源:TableStorageProviderTests.cs

示例9: AddItem_TwoMemoryContexts_TheSecondContextWillSeeAddedAndSavedItem

        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 );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:20,代碼來源:TableStorageProviderTests.cs

示例10: Upsert_MultipleItemsExist_UpdateSpecificItem

        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 );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:30,代碼來源:TableStorageProviderTests.cs

示例11: AddItem_TwoMemoryContexts_ThePrimaryContextsUncommitedStoreShouldBeUnchangedWhenAnotherIsCreated

        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 );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:21,代碼來源:TableStorageProviderTests.cs

示例12: Delete_ItemExistsAndTwoInstancesTryToDelete_ItemIsNotFoundInEitherCase

        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 );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:38,代碼來源:TableStorageProviderTests.cs

示例13: Update_ItemDoesNotExist_ShouldThrowEntityDoesNotExistException

        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" );
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:15,代碼來源:TableStorageProviderTests.cs

示例14: Add_ItemWithRowKeyThatContainsInvalidCharacters_ThrowsDataServiceRequestException

        public void Add_ItemWithRowKeyThatContainsInvalidCharacters_ThrowsDataServiceRequestException()
        {
            var item = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };

             string invalidRowKey = "/";
             _tableStorageProvider.Add( _tableName, item, _partitionKey, invalidRowKey );
             _tableStorageProvider.Save();
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:12,代碼來源:TableStorageProviderTests.cs

示例15: Add_ItemWithRowKeyThatIsTooLong_ThrowsDataServiceRequestException

        public void Add_ItemWithRowKeyThatIsTooLong_ThrowsDataServiceRequestException()
        {
            var item = new SimpleDataItem
             {
            FirstType = "a",
            SecondType = 1
             };

             string rowKeyThatIsLongerThan256Characters = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
             _tableStorageProvider.Add( _tableName, item, _partitionKey, rowKeyThatIsLongerThan256Characters );
             _tableStorageProvider.Save();
        }
開發者ID:mmcgill,項目名稱:hyde,代碼行數:12,代碼來源:TableStorageProviderTests.cs


注:本文中的TechSmith.Hyde.Test.SimpleDataItem類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。