public void WorksWithIXML()
        {
            var modifiedXml =
                new XMLPatched(
                    new XMLCursor("<root><node><leaf name='test' /></node></root>"),
                    new Directives()
                    .Xpath("//root/node/leaf")
                    .Attr("id", "123")
                    .Add("content")
                    .Set("testContent")
                    );

            Assert.NotEmpty(
                modifiedXml.Values("/root/node/leaf[@id='123']/content/text()")
                );
        }
Beispiel #2
0
        public void RejectsNoResults()
        {
            var doc =
                new XMLPatched(
                    "<root/>",
                    new Directives()
                    .Xpath("/root")
                    .Set("ugly_text")
                    );

            Assert.Throws <ArgumentException>(() =>
                                              new XMLString(
                                                  doc,
                                                  "/wrong/text()"
                                                  ).Value()
                                              );
        }
Beispiel #3
0
        public void ReturnsFallback()
        {
            var doc =
                new XMLPatched(
                    "<root/>",
                    new Directives()
                    .Xpath("/root")
                    .Set("ugly_text")
                    );

            Assert.Equal(
                "right text",
                new XMLString(
                    doc,
                    "/wrong/text()",
                    "right text"
                    ).Value()
                );
        }
Beispiel #4
0
        public void DeliversString()
        {
            var doc =
                new XMLPatched(
                    "<root/>",
                    new Directives()
                    .Xpath("/root")
                    .Set("ugly_text")
                    );

            Assert.Equal(
                "ugly_text",
                new XMLString(
                    doc,
                    "/root/text()",
                    "Unable to access the text of root node"
                    ).Value()
                );
        }