本文整理汇总了C#中Table.AddRow方法的典型用法代码示例。如果您正苦于以下问题:C# Table.AddRow方法的具体用法?C# Table.AddRow怎么用?C# Table.AddRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.AddRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: Returns_instance_on_full_match
public void Returns_instance_on_full_match()
{
var table = new Table("Field", "Value");
table.AddRow("String Property", "Joel Mario");
table.AddRow("Int Property", "20");
var result = table.FindInSet(testSet);
result.Should().BeSameAs(testSet[1]);
}
示例3: Sets_string_values
public virtual void Sets_string_values()
{
var table = new Table("Field", "Value");
table.AddRow("FirstName", "John");
table.AddRow("LastName", "Galt");
var person = GetThePerson(table);
person.FirstName.Should().Be("John");
person.LastName.Should().Be("Galt");
}
示例4: 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);
}
示例5: 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");
}
示例6: Returns_match_on_full_match
public void Returns_match_on_full_match()
{
var table = new Table("Field", "Value");
table.AddRow("String Property", "Joel Mario");
table.AddRow("Int Property", "20");
var results = table.FindAllInSet(testSet);
results.Count().Should().Be(1);
results.First().IntProperty.Should().Be(20);
results.First().StringProperty.Should().Be("Joel Mario");
}
示例7: Create_instance_will_fill_the_instance_
public void Create_instance_will_fill_the_instance_()
{
var table = new Table("Field", "Value");
table.AddRow("FirstName", "John");
table.AddRow("LastName", "Galt");
var expectedPerson = new Person { FirstName = "Ellsworth", LastName = "Toohey" };
var person = table.CreateInstance(() => expectedPerson);
person.FirstName.Should().Be("John");
person.LastName.Should().Be("Galt");
}
示例8: Can_create_an_instance_with_similar_enum_values
public void Can_create_an_instance_with_similar_enum_values()
{
var table = new Table("Field", "Value");
table.AddRow("FourthColor", "Green");
table.AddRow("ThirdColor", "Red");
table.AddRow("SecondColor", "Red");
table.AddRow("FirstColor", "Red");
var @class = table.CreateInstance<AClassWithMultipleEnums>();
@class.FirstColor.ShouldEqual(AClassWithMultipleEnums.Color.Red);
@class.SecondColor.ShouldEqual(AClassWithMultipleEnums.ColorAgain.Red);
@class.ThirdColor.ShouldEqual(AClassWithMultipleEnums.Color.Red);
@class.FourthColor.ShouldEqual(AClassWithMultipleEnums.ColorAgain.Green);
}
示例9: GetString_should_return_null_if_the_value_is_not_defined
public void GetString_should_return_null_if_the_value_is_not_defined()
{
var table = new Table("Name");
table.AddRow("John Galt");
table.Rows.First()
.GetString("SomethingThatDoesNotExist").ShouldEqual(null);
}
示例10: GetString_should_return_the_string_value_from_the_row
public void GetString_should_return_the_string_value_from_the_row()
{
var table = new Table("Name");
table.AddRow("John Galt");
table.Rows.First()
.GetString("Name").ShouldEqual("John Galt");
}
示例11: CreateAnInstanceTableForThisItemInTheSet
private Table CreateAnInstanceTableForThisItemInTheSet(int index)
{
var instanceTable = new Table("Field", "Value");
foreach (var header in table.Header)
instanceTable.AddRow(header, table.Rows[index][header]);
return instanceTable;
}
示例12: It_returns_null_when_no_match_can_be_found
public void It_returns_null_when_no_match_can_be_found()
{
var table = new Table("Field", "Value");
table.AddRow("String Property", "Peter Keating");
table.FindInSet(testSet).Should().BeNull();
}
示例13: Throws_exception_when_first_row_matches_but_second_does_not
public void Throws_exception_when_first_row_matches_but_second_does_not()
{
var table = new Table("Field", "Value");
table.AddRow("StringProperty", "Howard Roark");
table.AddRow("IntProperty", "20");
var test = new InstanceComparisonTestObject
{
StringProperty = "Howard Roark",
IntProperty = 10
};
ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, test);
comparisonResult.ExceptionWasThrown.ShouldBeTrue();
}
示例14: GetDecimal_should_return_MinValue_when_the_value_is_not_defined
public void GetDecimal_should_return_MinValue_when_the_value_is_not_defined()
{
var table = new Table("Amount");
table.AddRow("4.01");
table.Rows.First()
.GetDecimal("SomethingThatDoesNotExist").ShouldEqual(decimal.MinValue);
}
示例15: GetInt_should_return_MinValue_when_the_value_is_empty
public void GetInt_should_return_MinValue_when_the_value_is_empty()
{
var table = new Table("Count");
table.AddRow("");
table.Rows.First()
.GetInt32("Count").ShouldEqual(int.MinValue);
}