本文整理汇总了C#中Table.FindInSet方法的典型用法代码示例。如果您正苦于以下问题:C# Table.FindInSet方法的具体用法?C# Table.FindInSet怎么用?C# Table.FindInSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.FindInSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: Returns_instance_on_partial_match
public void Returns_instance_on_partial_match()
{
var table = new Table("Field", "Value");
table.AddRow("Int Property", "20");
var result = table.FindInSet(testSet);
result.Should().BeSameAs(testSet[1]);
}
示例3: It_should_throw_if_multiple_results_can_be_found
public void It_should_throw_if_multiple_results_can_be_found()
{
var john = new Person {FirstName = "John", LastName = "Doe"};
var jane = new Person {FirstName = "Jane", LastName = "Doe"};
var records = new List<Person> { john, jane};
var table = new Table("Field", "Value");
table.AddRow("LastName", "Doe");
Exception exception = null;
try
{
table.FindInSet(records);
}
catch (ComparisonException ex)
{
exception = ex;
}
exception.Should().NotBeNull();
exception.Message.Should().Be("Multiple instances match the table");
}
示例4: Returns_null_if_the_property_cannot_be_found
public void Returns_null_if_the_property_cannot_be_found()
{
var table = new Table("Field", "Value");
table.AddRow("What You Talkin Bout", "Willis");
table.FindInSet(testSet).Should().BeNull();
}
示例5: ExceptionWasThrownByThisSearch
private ComparisonTestResult ExceptionWasThrownByThisSearch(Table table, IEnumerable<InstanceComparisonTestObject> set)
{
var result = new ComparisonTestResult { ExceptionWasThrown = false };
try
{
table.FindInSet(set);
}
catch (ComparisonException ex)
{
result.ExceptionWasThrown = true;
result.ExceptionMessage = ex.Message;
}
return result;
}
示例6: Usage_example
public void Usage_example()
{
var howardRoark = new Person {FirstName = "Howard", LastName = "Roark"};
var johnGalt = new Person {FirstName = "John", LastName = "Galt"};
var records = new List<Person> {howardRoark, johnGalt};
Table table;
table = new Table("Field", "Value");
table.AddRow("FirstName", "Howard");
table.FindInSet(records).Should().Be(howardRoark);
table = new Table("Field", "Value");
table.AddRow("LastName", "Galt");
table.FindInSet(records).Should().Be(johnGalt);
table = new Table("Field", "Value");
table.AddRow("LastName", "Keating");
table.FindInSet(records).Should().BeNull();
}