private void Compare(Stack <ExpectedReadResult> pendingExpected, Stack <ObjectPropertyDefinition> pendingActual, ExpectedReadResult expectedComparison, ObjectPropertyDefinition actual) { var expected = expectedComparison.Value; var parent = expectedComparison.Parent; if (expected.Type != actual.Type) { parent.Add(new Mismatch(expected.Name, expected.Type, actual.Type)); } else { if (expected.Properties.Count > 0) { var currentDetails = new List <Detail>(); for (int i = expected.Properties.Count - 1; i >= 0; i--) { pendingExpected.Push(new ExpectedReadResult(currentDetails, expected.Properties[i])); pendingActual.Push(actual.Properties[i]); } parent.Add(new Match(currentDetails, expected.DisplayBydefault, expected.Name)); } else { if (CompareValues(expected.Type)(expected.Value, actual.Value)) { parent.Add(new Match(expected.Name, expected.Value, expected.DisplayBydefault, expected.Format, expected.Formatter)); } else { parent.Add(new Mismatch(expected.Name, expected.Value, actual.Value, expected.Format, expected.Formatter)); } } } }
public ExpectedReadResult(List <Detail> parent, ObjectPropertyDefinition value) { Parent = parent; Value = value; }