public void Will_match_guids_without_case_insensitivity() { var table = new Table("Field", "Value"); table.AddRow("GuidProperty", "DFFC3F4E-670A-400A-8212-C6841E2EA055"); ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, new InstanceComparisonTestObject { GuidProperty = new Guid("DFFC3F4E-670A-400A-8212-C6841E2EA055") }); comparisonResult.ExceptionWasThrown.Should().BeFalse(comparisonResult.ExceptionMessage); }
public void Does_not_throw_exception_when_value_of_matching_string_property_matches() { var table = new Table("Field", "Value"); table.AddRow("StringProperty", "Howard Roark"); var test = new InstanceComparisonTestObject { StringProperty = "Howard Roark" }; ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, test); comparisonResult.ExceptionWasThrown.Should().BeFalse(comparisonResult.ExceptionMessage); }
public void Throws_exception_when_value_of_matching_string_property_does_not_match() { var table = new Table("Field", "Value"); table.AddRow("StringProperty", "Howard Roark"); var test = new InstanceComparisonTestObject { StringProperty = "Peter Keating" }; ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, test); comparisonResult.ExceptionWasThrown.Should().BeTrue(); }
protected ComparisonTestResult DetermineIfExceptionWasThrownByComparingThese(Table table, SetComparisonTestObject[] items) { var result = new ComparisonTestResult { ExceptionWasThrown = false }; try { CallComparison(table, items); } catch (ComparisonException ex) { result.ExceptionWasThrown = true; result.ExceptionMessage = ex.Message; } return result; }
public void Should_not_throw_an_exception_when_the_date_time_value_is_midnight_and_the_table_does_not_include_a_time() { var table = new Table("Field", "Value"); table.AddRow("DateTimeProperty", "12/25/2010"); var test = new InstanceComparisonTestObject { DateTimeProperty = new DateTime(2010, 12, 25, 0, 0, 0) }; ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, test); comparisonResult.ExceptionWasThrown.Should().BeFalse(comparisonResult.ExceptionMessage); }
public void Should_not_throw_an_exception_when_actual_value_is_null_and_expected_is_empty() { var table = new Table("Field", "Value"); table.AddRow("NullableIntProperty", ""); var test = new InstanceComparisonTestObject { NullableIntProperty = null, }; ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, test); comparisonResult.ExceptionWasThrown.Should().BeFalse(comparisonResult.ExceptionMessage); }
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); }
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.Should().BeTrue(); }
private static ComparisonTestResult ExceptionWasThrownByThisComparison(Table table, StandardTypesComparisonTestObject test) { var result = new ComparisonTestResult { ExceptionWasThrown = false }; try { table.CompareToInstance(test); } catch (ComparisonException ex) { result.ExceptionWasThrown = true; result.ExceptionMessage = ex.Message; } return(result); }
private static ComparisonTestResult DetermineIfExceptionWasThrownByComparingThese(Table table, SetComparisonTestObject[] items) { var result = new ComparisonTestResult { ExceptionWasThrown = false }; try { table.CompareToSet(items); } catch (ComparisonException ex) { result.ExceptionWasThrown = true; result.ExceptionMessage = ex.Message; } return(result); }
public void Should_not_throw_an_exception_when_the_ToString_values_of_each_match() { var table = new Table("Field", "Value"); table.AddRow("StringProperty", "Howard Roark"); table.AddRow("IntProperty", "10"); table.AddRow("DateTimeProperty", "12/25/2010 8:00:00 AM"); var test = new InstanceComparisonTestObject { StringProperty = "Howard Roark", IntProperty = 10, DateTimeProperty = new DateTime(2010, 12, 25, 8, 0, 0) }; ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, test); comparisonResult.ExceptionWasThrown.Should().BeFalse(comparisonResult.ExceptionMessage); }
public void Will_property_handle_true_boolean_matches() { var table = new Table("Field", "Value"); table.AddRow("BoolProperty", "true"); ComparisonTestResult comparisonResult = ExceptionWasThrownByThisComparison(table, new InstanceComparisonTestObject { BoolProperty = true }); comparisonResult.ExceptionWasThrown.Should().BeFalse(comparisonResult.ExceptionMessage); comparisonResult = ExceptionWasThrownByThisComparison(table, new InstanceComparisonTestObject { BoolProperty = false }); comparisonResult.ExceptionWasThrown.Should().BeTrue(comparisonResult.ExceptionMessage); }