本文整理汇总了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);
}
示例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);
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}
示例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);
}
示例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");
}
示例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);
}
示例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));
}
示例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);
}
示例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();
}
示例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);
}
示例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");
}
示例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");
}