Example #1
0
        public void TestEmptyElement()
        {
            var elem = new Hangup();

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Hangup></Hangup>",
                elem.ToString()
                );
        }
Example #2
0
        public void TestElementWithTextNode()
        {
            var elem = new Hangup();

            elem.AddText("Here is the content");

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Hangup>Here is the content</Hangup>",
                elem.ToString()
                );
        }
Example #3
0
        public void TestElementWithExtraAttributes()
        {
            var elem = new Hangup();

            elem.SetOption("newParam1", "value");
            elem.SetOption("newParam2", 1);

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Hangup newParam1=\"value\" newParam2=\"1\"></Hangup>",
                elem.ToString()
                );
        }
Example #4
0
        public void TestMixedContent()
        {
            var elem = new Hangup();

            elem.AddText("before")
            .AddChild("Child").AddText("content");
            elem.AddText("after");

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Hangup>before<Child>content</Child>after</Hangup>",
                elem.ToString()
                );
        }
Example #5
0
        public void TestAllowGenericChildNodes()
        {
            var elem = new Hangup();

            elem.AddChild("generic-tag").AddText("Content").SetOption("tag", true);

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Hangup>" + Environment.NewLine +
                "  <generic-tag tag=\"True\">Content</generic-tag>" + Environment.NewLine +
                "</Hangup>",
                elem.ToString()
                );
        }