public StringBuilder Format(ListComparer.Result result) { var sb = new StringBuilder(); Format("missing", result.Missing, result.MissingCount, ref sb); Format("unexpected", result.Unexpected, result.UnexpectedCount, ref sb); return(sb); }
public void Compare_NoUnexpected_UnexpectedNotVisible() { var res = new ListComparer.Result( new List<string> { "a", "b", "c" }, null ); var formatter = new ListComparisonFormatter(); var display = formatter.Format(res).ToString(); Assert.That(display, Is.StringContaining("No unexpected")); }
public void Compare_BothEmpty_CorrectDisplay() { var res = new ListComparer.Result( new List<string> { }, new List<string> { } ); var formatter = new ListComparisonFormatter(); var display = formatter.Format(res).ToString(); Assert.That(display, Is.StringContaining("No missing item")); Assert.That(display, Is.StringContaining("No unexpected item")); }
public void Compare_MultipleMissing_Plural() { var res = new ListComparer.Result( new List<string> { "a", "b", "c" }, null ); var formatter = new ListComparisonFormatter(); var display = formatter.Format(res).ToString(); Assert.That(display, Is.StringContaining("Missing items")); Assert.That(display, Is.StringContaining("<a>")); Assert.That(display, Is.StringContaining("<b>")); Assert.That(display, Is.StringContaining("<c>")); }
public void RenderCompared_WithSpecialRows_DisplayTextForThisKindOfRows( int missingRowCount , int unexpectedRowCount , string expectedText) { var compared = new ListComparer.Result( GetDataRows(missingRowCount) , GetDataRows(unexpectedRowCount) ); var msg = new ItemsMessage(FailureReportProfile.Default); msg.Build(null, null, compared); var value = msg.RenderCompared(); Assert.That(value, Is.StringContaining(expectedText)); }
public void Compare_Mix_CorrectDisplay() { var res = new ListComparer.Result( new List<string> { "x" }, new List<string> { "a", "b", "c" } ); var formatter = new ListComparisonFormatter(); var display = formatter.Format(res).ToString(); Assert.That(display, Is.Not.StringContaining("Missing items")); Assert.That(display, Is.StringContaining("Missing item")); Assert.That(display, Is.StringContaining("Unexpected items")); Assert.That(display, Is.StringContaining("<x>")); Assert.That(display, Is.StringContaining("<a>")); Assert.That(display, Is.StringContaining("<b>")); Assert.That(display, Is.StringContaining("<c>")); }