Example #1
0
 public static void AssertLinesInclude(this DocumentAnalyzer actual, params LineSpan[] expected)
 {
     var missingLines = new HashSet<LineSpan>(expected).Except(actual.GetAllLines());
     if (missingLines.Any()) {
         Assert.Fail("Lines not found:\r\n{0}\r\n\r\nActual lines:\r\n{1}",
             missingLines.ToFormattedString(),
             actual.GetAllLines().ToFormattedString());
     }
 }
Example #2
0
 public static void AssertLinesIncludeExactly(this DocumentAnalyzer actual, params LineSpan[] expected)
 {
     var missingLines = new HashSet<LineSpan>(expected).Except(actual.GetAllLines());
     var unexpectedLines = new HashSet<LineSpan>(actual.GetAllLines()).Except(expected);
     var message = new List<string>();
     if (missingLines.Any()) {
         message.Add("Lines not found:\r\n" + missingLines.ToFormattedString());
     }
     if (unexpectedLines.Any()) {
         message.Add("Unexpected lines:\r\n" + unexpectedLines.ToFormattedString());
     }
     if (message.Any()) {
         message.Add("Actual lines:\r\n" + actual.GetAllLines().Distinct().ToFormattedString());
         Assert.Fail(string.Join("\r\n\r\n", message));
     }
 }