Example #1
0
        public void TestElementWithParams()
        {
            var elem = new Siprec("name", "connector_name", Siprec.TrackEnum.InboundTrack);

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

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

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

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

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

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

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

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Siprec>" + Environment.NewLine +
                "  <generic-tag tag=\"True\">Content</generic-tag>" + Environment.NewLine +
                "</Siprec>",
                elem.ToString()
                );
        }
Example #6
0
        public void TestElementWithChildren()
        {
            var elem = new Siprec();

            elem.Parameter("name", "value");

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

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

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Siprec>before<Child>content</Child>after</Siprec>",
                elem.ToString()
                );
        }