public static string GetGenerateAssertOrderedMatch(TestExecuterResult result) { var sb = new StringBuilder(); sb.Append("\t\t\tAssert.AreEqual(").Append(result.MutatedRows.Count.ToString("D", CultureInfo.InvariantCulture)).AppendLine(", result.MutatedRows.Count);"); if (result.MutatedRows.Count > 0) { sb.AppendLine("Assert.That.ExactMatch(result.MutatedRows, new List<CaseInsensitiveStringKeyDictionary<object>>() {"); sb.AppendJoin(",\n", result.MutatedRows.Select(row => "\t\t\t\tnew CaseInsensitiveStringKeyDictionary<object>() { " + string.Join(", ", row.Values.Select(kvp => "[\"" + kvp.Key + "\"] = " + FormatToCSharpVariable(row[kvp.Key]))) + " }")); sb.AppendLine(" });"); } var exceptions = result.Process.Context.GetExceptions(); sb.AppendLine("\t\t\tvar exceptions = context.GetExceptions();"); sb.Append("\t\t\tAssert.AreEqual(").Append(exceptions.Count.ToString("D", CultureInfo.InvariantCulture)).AppendLine(", exceptions.Count);"); for (var i = 0; i < exceptions.Count; i++) { var ex = exceptions[i]; sb.Append("\t\t\tAssert.IsTrue(exceptions[").Append(i.ToString("D", CultureInfo.InvariantCulture)).Append("] is ").Append(ex.GetType().Name).AppendLine(");"); } return(sb.ToString()); }
public static TestExecuterResult Execute(IProcessBuilder builder) { var result = new TestExecuterResult { Process = builder.Build(), }; result.MutatedRows = result.Process.Evaluate().TakeRowsAndReleaseOwnership().ToList(); return(result); }