public void Does_not_throw_an_exception_when_the_table_is_empty_and_the_set_is_empty() { var table = new Table("StringProperty"); var items = new SetComparisonTestObject[] {}; var comparisonResult = DetermineIfExceptionWasThrownByComparingThese(table, items); comparisonResult.ExceptionWasThrown.ShouldBeFalse(comparisonResult.ExceptionMessage); }
public void Throws_an_exception_when_there_is_one_row_but_the_set_is_empty() { var table = new Table("StringProperty"); table.AddRow("this is not an empty table"); var items = new SetComparisonTestObject[] {}; var comparisonResult = DetermineIfExceptionWasThrownByComparingThese(table, items); comparisonResult.ExceptionWasThrown.ShouldBeTrue(comparisonResult.ExceptionMessage); }
public void SetUp() { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); testInstance = new SetComparisonTestObject { DateTimeProperty = DateTime.Today, GuidProperty = testGuid1, IntProperty = 1, StringProperty = "a" }; testCollection = new[] { testInstance, new SetComparisonTestObject { DateTimeProperty = DateTime.Today, GuidProperty = testGuid2, IntProperty = 2, StringProperty = "b" }, }; }
private static ComparisonException GetTheExceptionThrowByComparingThese(Table table, SetComparisonTestObject[] items) { try { table.CompareToSet(items); } catch (ComparisonException ex) { return ex; } return null; }
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; }