public void ReturnsNullForRecursiveParentWhenNotRecursive() { // Given _ = new TestExecutionContext(); IDocument a = new TestDocument("A"); IDocument x = new TestDocument("X") { { Keys.Children, new IDocument[] { a, new TestDocument("B") } } }; IDocument y = new TestDocument("Y"); IDocument z = new TestDocument("Z") { { Keys.Children, new IDocument[] { new TestDocument("C"), x } } }; // When IDocument result = a.GetParent(new[] { y, z }, false); // Then result.ShouldBeNull(); }
public void GetsRecursiveParent() { // Given _ = new TestExecutionContext(); IDocument a = new TestDocument("A"); IDocument x = new TestDocument("X") { { Keys.Children, new IDocument[] { a, new TestDocument("B") } } }; IDocument y = new TestDocument("Y"); IDocument z = new TestDocument("Z") { { Keys.Children, new IDocument[] { new TestDocument("C"), x } } }; // When IDocument result = a.GetParent(new[] { y, z }); // Then result.ShouldBe(x); }
public void ReturnsNullWhenNoParent() { // Given IDocument a = new TestDocument("A"); IDocument x = new TestDocument("X") { { Keys.Children, new IDocument[] { new TestDocument("B") } } }; IDocument y = new TestDocument("Y"); // When IDocument result = a.GetParent(new[] { x, y }); // Then result.ShouldBeNull(); }
public void GetsParent() { // Given IDocument a = new TestDocument("A"); IDocument x = new TestDocument("X") { { Keys.Children, new IDocument[] { a, new TestDocument("B") } } }; IDocument y = new TestDocument("Y"); // When IDocument result = a.GetParent(new[] { x, y }); // Then result.ShouldBe(x); }