bool HasSerializationChanged(Control control, string assertId) { var layout = DumpLayout(control); var actualText = SerializeDumpData(layout); GenerateDataDelegate generateLayout = path => File.WriteAllText(path, actualText); CompareDataDelegate compareLayouts = (expected, actual, diff) => { var expectedText = File.ReadAllText(expected); var diffEngine = new my.utils.Diff(); var diffs = diffEngine.DiffText(actualText, expectedText); if (diffs.Length == 0) return true; // TODO: Calculate a text-based diff patch and write it in a file. return false; }; return Assert(assertId, "json", generateLayout, compareLayouts); }
private Chunk CreateChunk(Diff.Item change, CompareOptions options) { var chunk = new Chunk(); chunk.start1 = change.StartA; chunk.start2 = change.StartB; chunk.length1 = change.deletedA + options.ContextSize; chunk.length2 = change.insertedB + options.ContextSize; chunk.diffs = new List<Line>(); return chunk; }