/// <summary> /// Determines whether the specified object reference is a cyclic reference to the same object earlier in the /// equivalency validation. /// </summary> /// <remarks> /// The behavior of a cyclic reference is determined byt he <see cref="CyclicReferenceHandling"/> constructor /// parameter. /// </remarks> public bool IsCyclicReference(ObjectReference reference) { bool isCyclic = false; if (reference.IsReference) { if (references.Contains(reference)) { isCyclic = true; if (handling == CyclicReferenceHandling.ThrowException) { AssertionScope.Current.FailWith( "Expected {context:subject} to be {expectation}{reason}, but it contains a cyclic reference."); } } else { references.Add(reference); } } return isCyclic; }
private bool IsParentOf(ObjectReference other) { return (other.path.Length > path.Length) && other.path.Take(path.Length).SequenceEqual(path); }
private bool IsParentOf(ObjectReference other) { return((other.path.Length > path.Length) && other.path.Take(path.Length).SequenceEqual(path)); }
private bool IsParentOf(ObjectReference other) { string[] path = GetPathElements(); string[] otherPath = other.GetPathElements(); return((otherPath.Length > path.Length) && otherPath.Take(path.Length).SequenceEqual(path)); }