Beispiel #1
0
        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());
        }
Beispiel #2
0
        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());
        }
Beispiel #3
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);
        }