public void write_simple_attribute()
        {
            var node = XmlAttCentricMediaNode.ForRoot("root");

            node.SetAttribute("a", "1");

            node.Element.GetAttribute("a").ShouldEqual("1");
        }
Example #2
0
        public void SetUp()
        {
            theAccessorProjection = AccessorProjection <ValueTarget> .For(x => x.Age);

            _theValues = new SimpleValues <ValueTarget>(new ValueTarget
            {
                Age = 37
            });

            theMediaNode = XmlAttCentricMediaNode.ForRoot("root");
        }
        public void writing_a_list()
        {
            var node = XmlAttCentricMediaNode.ForRoot("root");
            var list = node.AddList("node", "leaf");

            list.Add().SetAttribute("name", "Rand");
            list.Add().SetAttribute("name", "Perrin");
            list.Add().SetAttribute("name", "Mat");

            node.Element.OuterXml.ShouldEqual("<root><node><leaf name=\"Rand\" /><leaf name=\"Perrin\" /><leaf name=\"Mat\" /></node></root>");
        }
        public void add_simple_child_to_original_media_node()
        {
            var node = XmlAttCentricMediaNode.ForRoot("root");

            node.AddChild("childA");
            node.AddChild("childB");

            node.Element.ChildNodes.Count.ShouldEqual(2);
            node.Element.FirstChild.Name.ShouldEqual("childA");
            node.Element.LastChild.Name.ShouldEqual("childB");
        }
Example #5
0
        public void SetUp()
        {
            anAddress = new Address {
                Line1   = "22 Cherry Lane",
                City    = "Austin",
                State   = "TX",
                ZipCode = "78703"
            };

            aTarget = new SimpleValues <Address>(anAddress);
            aNode   = XmlAttCentricMediaNode.ForRoot("root");
        }
        public void building_a_child_propogates_the_XmlLinkWriter()
        {
            var node = XmlAttCentricMediaNode.ForRoot("root");

            node.AddChild("childA").As <XmlMediaNode>().LinkWriter.ShouldBeTheSameAs(node.LinkWriter);
        }
        public void write_null_value_as_empty_string()
        {
            var node = XmlAttCentricMediaNode.ForRoot("root");

            node.SetAttribute("a", null);
        }