public void AddAndReturnChild_Elements_AddChildToParent() { var parent = new XsltElement("Parent"); var child = new XsltElement("Child"); var returnedElement = parent.AddAndReturnChild(child); Assert.Same(child, returnedElement); Assert.Contains(parent.Elements(), e => e == child); Assert.Same(parent, child.Parent); }
public static XsltElement GetPathPartElement(XsltElement parentElement, XsltElement pathPartElement) => parentElement.FirstOrDefaultXsltElement(pathPartElement) ?? parentElement.AddAndReturnChild(pathPartElement);