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);
}