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

            var returnedBuilder = builder.Append(testElement);

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

            builder.Append(null);

            var document = builder.Build();

            Assert.NotNull(document.Root);
        }
Exemple #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);
        }
Exemple #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");
        }