本文整理汇总了C#中Table.CompareToInstance方法的典型用法代码示例。如果您正苦于以下问题:C# Table.CompareToInstance方法的具体用法?C# Table.CompareToInstance怎么用?C# Table.CompareToInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.CompareToInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExceptionWasThrownByThisComparison
private static ComparisonTestResult ExceptionWasThrownByThisComparison(Table table, InstanceComparisonTestObject test)
{
var result = new ComparisonTestResult { ExceptionWasThrown = false };
try
{
table.CompareToInstance(test);
}
catch (ComparisonException ex)
{
result.ExceptionWasThrown = true;
result.ExceptionMessage = ex.Message;
}
return result;
}
示例2: GetExceptionThrownByThisComparison
private static ComparisonException GetExceptionThrownByThisComparison(Table table, InstanceComparisonTestObject test)
{
try
{
table.CompareToInstance(test);
}
catch (ComparisonException ex)
{
return ex;
}
return null;
}
示例3: Should_be_able_to_compare_the_fancy_name
public void Should_be_able_to_compare_the_fancy_name()
{
Service.Instance.RegisterValueRetriever(new FancyNameValueRetriever());
Service.Instance.RegisterValueComparer(new FancyNameValueComparer());
var table = new Table("Field", "Value");
table.AddRow("Name", "John Galt");
var expectedName = new FancyName() { FirstName = "John", LastName = "Galt" };
var expectedLad = new FancyLad() { Name = expectedName };
table.CompareToInstance<FancyLad>(expectedLad);
}
示例4: ThenTheExecutionSummaryShouldContain
public void ThenTheExecutionSummaryShouldContain(Table expectedSummary)
{
testExecutionResult.LastExecutionSummary.ShouldNotBeNull();
expectedSummary.CompareToInstance(testExecutionResult.LastExecutionSummary);
}
示例5: Should_be_able_to_compare_the_category
public void Should_be_able_to_compare_the_category()
{
Service.Instance.RegisterValueRetriever(new ProductCategoryValueRetriever());
Service.Instance.RegisterValueComparer(new ProductCategoryValueComparer());
var table = new Table("Field", "Value");
table.AddRow("Name", "Cucumber");
table.AddRow("Category", "Vegetable");
var expectedCategory = new ProductCategory() { Name = "Vegetable" };
var expectedProduct = new Product() { Name = "Cucumber", Category = expectedCategory };
table.CompareToInstance<Product>(expectedProduct);
}