public void AddXsltElement_Element_AddsToEnd() { var firstChild = new XsltElement("FirstChild"); var secondChild = new XsltElement("SecondChild"); var parentElement = new XsltElement("Parent", firstChild, secondChild); var addedElement = new XsltElement("ElementContentType"); parentElement.AddXsltElement(addedElement); Assert.Same(addedElement, parentElement.Elements().Last()); }
public void AddXsltElement_Attribute_AddsFirst() { var firstChild = new XsltElement("FirstChild"); var secondChild = new XsltElement("SecondChild"); var parentElement = new XsltElement("Parent", firstChild, secondChild); var addedElement = new XsltElement(XsltElementType.Attribute, new XAttribute("name", "AttributeContentType")); parentElement.AddXsltElement(addedElement); Assert.Same(addedElement, parentElement.Elements().First()); }
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); }