コード例 #1
0
        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);
        }
コード例 #2
0
 public static XsltElement GetPathPartElement(XsltElement parentElement, XsltElement pathPartElement) =>
 parentElement.FirstOrDefaultXsltElement(pathPartElement) ??
 parentElement.AddAndReturnChild(pathPartElement);