Exemple #1
0
        public void TestElementWithParams()
        {
            var elem = new Refer(new Uri("https://example.com"), Twilio.Http.HttpMethod.Get);

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Refer action=\"https://example.com\" method=\"GET\"></Refer>",
                elem.ToString()
                );
        }
Exemple #2
0
        public void TestEmptyElement()
        {
            var elem = new Refer();

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

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

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

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

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

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

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

            elem.ReferSip(new Uri("https://example.com"));

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<Refer>" + Environment.NewLine +
                "  <Sip>https://example.com</Sip>" + Environment.NewLine +
                "</Refer>",
                elem.ToString()
                );
        }
Exemple #7
0
        public void TestMixedContent()
        {
            var elem = new Refer();

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

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