protected void CheckTypeEquality <T>(T a, T b, IList <Type> types, PropertyPath path) {
protected bool IsDifferentSeq <T>(IEnumerable <T> expected, IEnumerable <T> actual, Func <T, T, PropertyPath, bool> visit, PropertyPath path) where T : class { var expectedEnumerator = expected.GetEnumerator(); var actualEnumerator = actual.GetEnumerator(); var anyDifferent = false; for (var i = 0; ; i++) { var expectedHasMore = expectedEnumerator.MoveNext(); var actualHasMore = actualEnumerator.MoveNext(); if (expectedHasMore && actualHasMore) { anyDifferent |= visit(expectedEnumerator.Current, actualEnumerator.Current, path + i.ToString()); } else { if (expectedHasMore) { Report(path, $"missing element after element {i}"); } if (actualHasMore) { Report(path, $"extraneous element after element {i}"); } break; } } return(anyDifferent); }
protected bool IsDifferentNamedSeq <T>(IEnumerable <T> e1, IEnumerable <T> e2, Func <T, T, PropertyPath, bool> visit, PropertyPath path) where T : class, IEdmNamedElement { var pairs = e1.FullOuterJoin(e2, i => i.Name, i => i.Name); var anyDifferent = false; foreach (var(name, a, b) in pairs) { if (a != null && b != null) { anyDifferent |= visit(a, b, path + name); } else if (a == null) { var lox = b is IEdmLocatable loc ? loc.Location : null; Report(path, $"superfluous item with name {name}", lox); } else if (b == null) { Report(path, $"missing item with name {name}"); } } return(anyDifferent); }
protected bool IsDifferent(EdmReferentialConstraintPropertyPair a, EdmReferentialConstraintPropertyPair b, PropertyPath path) { var anyDifferent = false; anyDifferent |= IsDifferent(a.DependentProperty, b.DependentProperty, path + "DependentProperty"); anyDifferent |= IsDifferent(a.PrincipalProperty, b.PrincipalProperty, path + "PrincipalProperty"); return(anyDifferent); }