static CompareResult Compare( string received, string verified, IReadOnlyDictionary <string, object> context, Action <IDiffingStrategyCollection>?action) { var builder = DiffBuilder.Compare(verified); builder.WithTest(received); if (action != null) { builder.WithOptions(action); } if (context.GetCompareSettings(out var innerSettings)) { builder.WithOptions(innerSettings.Action); } var diffs = builder.Build().ToList(); if (diffs.Any()) { var stringBuilder = new StringBuilder(Environment.NewLine); foreach (var diff in diffs) { DiffConverter.Append(diff, stringBuilder); } return(CompareResult.NotEqual(stringBuilder.ToString())); } return(CompareResult.Equal); }
public static void HtmlEqual(string expected, string actual) { var diffs = DiffBuilder.Compare(expected).WithTest(actual).Build().ToArray(); if (diffs.Any()) { var sb = new StringBuilder(); sb.AppendLine("AssertEx.HtmlEqual() Failure"); foreach (var diff in diffs) { DiffConverter.Append(diff, sb); } throw new XunitException(sb.ToString()); } }