当前位置: 首页>>代码示例>>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;未经允许,请勿转载。