Example #1
0
        public void Append_ReturnedBuilderIsSameObject()
        {
            var builder     = new TransformBuilder();
            var testElement = new XElement("TestElement");

            var returnedBuilder = builder.Append(testElement);

            Assert.Same(builder, returnedBuilder);
        }
Example #2
0
        public void Append_NullValue_IsIgnored()
        {
            var builder = new TransformBuilder();

            builder.Append(null);

            var document = builder.Build();

            Assert.NotNull(document.Root);
        }
Example #3
0
        public void Append_SingleValue_AddsObjectToRoot()
        {
            var builder     = new TransformBuilder();
            var testElement = new XElement("TestElement");

            builder.Append(testElement);

            var document = builder.Build();
            var rootNode = document.Root;

            Assert.NotNull(rootNode);
            Assert.Contains(rootNode.Elements(), e => e == testElement);
        }
Example #4
0
        public void Append_MultipleValues_AddsObjectsToRoot()
        {
            var builder       = new TransformBuilder();
            var testElement   = new XElement("TestElement");
            var testAttribute = new XAttribute("TestAttribute", "TestAttributeValue");

            builder.Append(testElement, testAttribute);

            var document = builder.Build();
            var rootNode = document.Root;

            Assert.NotNull(rootNode);
            Assert.Contains(rootNode.Elements(), e => e.Name.LocalName == "TestElement");
            Assert.Contains(rootNode.Attributes(),
                            e => e.Name.LocalName == "TestAttribute" && e.Value == "TestAttributeValue");
        }