当前位置: 首页>>代码示例>>C#>>正文


C# Table.CreateInstance方法代码示例

本文整理汇总了C#中Table.CreateInstance方法的典型用法代码示例。如果您正苦于以下问题:C# Table.CreateInstance方法的具体用法?C# Table.CreateInstance怎么用?C# Table.CreateInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Table的用法示例。


在下文中一共展示了Table.CreateInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateInstance_returns_the_object_returned_from_the_func

 public void CreateInstance_returns_the_object_returned_from_the_func()
 {
     var table = new Table("Field", "Value");
     var expectedPerson = new Person();
     var person = table.CreateInstance(() => expectedPerson);
     person.Should().Be(expectedPerson);
 }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:7,代码来源:CreateInstanceHelperMethodTests_WithFunc.cs

示例2: The_value_should_be_set_if_it_is_in_the_table

        public void The_value_should_be_set_if_it_is_in_the_table()
        {
            var table = new Table("Field", "Value");
            table.AddRow("TestProperty", "Value2");

            var test = table.CreateInstance<TestEntity>();
            test.TestProperty.ShouldEqual(TestEnum.Value2);
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:8,代码来源:NullableEnumTests.cs

示例3: Create_instance_will_set_values_with_a_vertical_table_when_there_is_one_row_and_one_column

        public void Create_instance_will_set_values_with_a_vertical_table_when_there_is_one_row_and_one_column()
        {
            var table = new Table("FirstName");
            table.AddRow("Howard");
            var person = table.CreateInstance<Person>();

            person.FirstName.Should().Be("Howard");
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:8,代码来源:CreateInstanceHelperMethodTests.cs

示例4: Sets_properties_from_column_names_with_blanks

        public void Sets_properties_from_column_names_with_blanks()
        {
            var table = new Table("Field", "Value");
            table.AddRow("First Name", "John");

            var person = table.CreateInstance<Person>();

            person.FirstName.ShouldEqual("John");
        }
开发者ID:eddpeterson,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例5: Sets_properties_with_different_case

        public void Sets_properties_with_different_case()
        {
            var table = new Table("Field", "Value");
            table.AddRow("firstname", "John");

            var person = table.CreateInstance<Person>();

            person.FirstName.ShouldEqual("John");
        }
开发者ID:eddpeterson,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例6: Sets_decimal_values

        public void Sets_decimal_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("Salary", 9.78M.ToString());

            var person = table.CreateInstance<Person>();

            person.Salary.ShouldEqual(9.78M);
        }
开发者ID:otac0n,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例7: Sets_nullable_int_values

        public void Sets_nullable_int_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("NullableInt", "9");

            var person = table.CreateInstance<Person>();

            person.NullableInt.ShouldEqual(9);
        }
开发者ID:heinrichbreedt,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例8: Table

        public void When_one_row_exists_with_two_headers_and_the_first_row_value_is_not_a_property_then_treat_as_horizontal_table()
        {
            var table = new Table("AnotherValue", "YetAnotherValue");
            table.AddRow("x", "y");

            var test = table.CreateInstance<TestingVerticalTable>();
            test.AnotherValue.Should().Be("x");
            test.YetAnotherValue.Should().Be("y");
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例9: Sets_enum_values

        public void Sets_enum_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("Sex", "Male");

            var person = table.CreateInstance<Person>();

            person.Sex.ShouldEqual(Sex.Male);
        }
开发者ID:otac0n,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例10: Sets_datetime_values

        public void Sets_datetime_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("BirthDate", "12/31/2010");

            var person = table.CreateInstance<Person>();

            person.BirthDate.ShouldEqual(new DateTime(2010, 12, 31));
        }
开发者ID:nandrew,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例11: Sets_int_values

        public void Sets_int_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("NumberOfIdeas", "3");

            var person = table.CreateInstance<Person>();

            person.NumberOfIdeas.ShouldEqual(3);
        }
开发者ID:otac0n,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例12: Sets_bool_values

        public void Sets_bool_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("IsRational", "true");

            var person = table.CreateInstance<Person>();

            person.IsRational.ShouldBeTrue();
        }
开发者ID:otac0n,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例13: Sets_nullable_decimal_values

        public void Sets_nullable_decimal_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("NullableDecimal", "19.78");

            var person = table.CreateInstance<Person>();

            person.NullableDecimal.ShouldEqual(19.78M);
        }
开发者ID:heinrichbreedt,项目名称:SpecFlow,代码行数:9,代码来源:CreateInstanceHelperMethodTests.cs

示例14: When_one_row_exists_with_three_headers_then_treat_as_horizontal_table

        public void When_one_row_exists_with_three_headers_then_treat_as_horizontal_table()
        {
            var table = new Table("Field", "Value", "AnotherValue");
            table.AddRow("one", "two", "three");

            var test = table.CreateInstance<TestingVerticalTable>();
            test.Field.Should().Be("one");
            test.Value.Should().Be("two");
            test.AnotherValue.Should().Be("three");
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:10,代码来源:CreateInstanceHelperMethodTests.cs

示例15: Sets_string_values

        public void Sets_string_values()
        {
            var table = new Table("Field", "Value");
            table.AddRow("FirstName", "John");
            table.AddRow("LastName", "Galt");

            var person = table.CreateInstance<Person>();

            person.FirstName.ShouldEqual("John");
            person.LastName.ShouldEqual("Galt");
        }
开发者ID:otac0n,项目名称:SpecFlow,代码行数:11,代码来源:CreateInstanceHelperMethodTests.cs


注:本文中的Table.CreateInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。