本文整理汇总了C#中Table.CreateSet方法的典型用法代码示例。如果您正苦于以下问题:C# Table.CreateSet方法的具体用法?C# Table.CreateSet怎么用?C# Table.CreateSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.CreateSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Sets_properties_from_column_names_to_properties_with_dash
public void Sets_properties_from_column_names_to_properties_with_dash()
{
var table = new Table("first-name");
table.AddRow("John");
var people = table.CreateSet<Person>();
people.First().FirstName.Should().Be("John");
}
示例2: Sets_properties_from_column_names_to_properties_with_umlaute
public void Sets_properties_from_column_names_to_properties_with_umlaute()
{
var table = new Table("WithUmlauteäöü");
table.AddRow("John");
var people = table.CreateSet<Person>();
people.First().WithUmlauteäöü.Should().Be("John");
}
示例3: Sets_properties_with_different_case
public void Sets_properties_with_different_case()
{
var table = new Table("firstname");
table.AddRow("John");
var people = table.CreateSet<Person>();
people.First().FirstName.ShouldEqual("John");
}
示例4: Returns_one_instance_when_there_is_one_row
public void Returns_one_instance_when_there_is_one_row()
{
var table = new Table("FirstName");
table.AddRow("John");
var people = table.CreateSet<Person>();
people.Count().ShouldEqual(1);
}
示例5: Sets_properties_from_column_names_with_blanks
public void Sets_properties_from_column_names_with_blanks()
{
var table = new Table("first name");
table.AddRow("John");
var people = table.CreateSet<Person>();
people.First().FirstName.ShouldEqual("John");
}
示例6: Sets_properties_from_column_names_with_underscore_to_properties_with_underscore
public void Sets_properties_from_column_names_with_underscore_to_properties_with_underscore()
{
var table = new Table("With_Underscore");
table.AddRow("John");
var people = table.CreateSet<Person>();
people.First().With_Underscore.Should().Be("John");
}
示例7: Returns_two_instances_when_there_are_two_rows
public void Returns_two_instances_when_there_are_two_rows()
{
var table = new Table("FirstName");
table.AddRow("John");
table.AddRow("Howard");
var people = table.CreateSet<Person>();
people.Count().ShouldEqual(2);
}
示例8: Sets_datetime_on_the_instance_when_type_is_datetime
public void Sets_datetime_on_the_instance_when_type_is_datetime()
{
var table = new Table("FirstName", "LastName", "BirthDate", "NumberOfIdeas", "Salary", "IsRational");
table.AddRow("", "", "4/28/2009", "3", "", "");
var people = table.CreateSet<Person>();
people.First().BirthDate.ShouldEqual(new DateTime(2009, 4, 28));
}
示例9: Can_set_a_nullable_int
public void Can_set_a_nullable_int()
{
var table = new Table("FirstName", "LastName", "BirthDate", "NumberOfIdeas", "Salary", "IsRational");
table.AddRow("", "", "", "3", "", "true");
var people = table.CreateSet<NullablePerson>();
people.First().NumberOfIdeas.ShouldEqual(3);
}
示例10: Sets_a_nullable_double_to_null_when_the_value_is_empty
public void Sets_a_nullable_double_to_null_when_the_value_is_empty()
{
var table = new Table("NullableDouble");
table.AddRow("");
var people = table.CreateSet<NullablePerson>();
people.First().NullableDouble.ShouldBeNull();
}
示例11: Sets_int_values_on_the_instance_when_type_is_int
public void Sets_int_values_on_the_instance_when_type_is_int()
{
var table = new Table("FirstName", "LastName", "BirthDate", "NumberOfIdeas", "Salary", "IsRational");
table.AddRow("", "", "", "3", "", "");
var people = table.CreateSet<Person>();
people.First().NumberOfIdeas.ShouldEqual(3);
}
示例12: Sets_a_nullable_int_to_null_when_the_value_is_empty
public void Sets_a_nullable_int_to_null_when_the_value_is_empty()
{
var table = new Table("FirstName", "LastName", "BirthDate", "NumberOfIdeas", "Salary", "IsRational");
table.AddRow("", "", "", "", "", "");
var people = table.CreateSet<NullablePerson>();
people.First().NumberOfIdeas.ShouldBeNull();
}
示例13: Can_set_a_nullable_datetime
public void Can_set_a_nullable_datetime()
{
var table = new Table("FirstName", "LastName", "BirthDate", "NumberOfIdeas", "Salary", "IsRational");
table.AddRow("", "", "4/28/2009", "3", "", "");
var people = table.CreateSet<NullablePerson>();
people.First().BirthDate.ShouldEqual(new DateTime(2009, 4, 28));
}
示例14: Sets_string_values_on_the_instance_when_type_is_string
public void Sets_string_values_on_the_instance_when_type_is_string()
{
var table = new Table("FirstName", "LastName", "BirthDate", "NumberOfIdeas", "Salary", "IsRational");
table.AddRow("John", "Galt", "", "", "", "");
var people = table.CreateSet<Person>();
people.First().FirstName.ShouldEqual("John");
people.First().LastName.ShouldEqual("Galt");
}
示例15: The_correct_TableRow_is_passed_to_the_callback
public void The_correct_TableRow_is_passed_to_the_callback()
{
var table = new Table("FirstName", "_SpecialInfo");
table.AddRow("John", "John Info");
table.AddRow("Howard", "Howard Info");
var people = table.CreateSet(row => new Person() {LastName = row["_SpecialInfo"]});
foreach (var person in people)
LastNameString_ShouldStartWith_FirstNameString(person);
}