Ejemplo n.º 1
0
        public void TestElementWithParams()
        {
            var elem = new SsmlLang("words", SsmlLang.XmlLangEnum.DaDk);

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<lang xml:lang=\"da-DK\">words</lang>",
                elem.ToString()
                );
        }
Ejemplo n.º 2
0
        public void TestEmptyElement()
        {
            var elem = new SsmlLang();

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

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

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

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

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<lang newParam1=\"value\" newParam2=\"1\"></lang>",
                elem.ToString()
                );
        }
Ejemplo n.º 5
0
        public void TestMixedContent()
        {
            var elem = new SsmlLang();

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

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<lang>before<Child>content</Child>after</lang>",
                elem.ToString()
                );
        }
Ejemplo n.º 6
0
        public void TestAllowGenericChildNodes()
        {
            var elem = new SsmlLang();

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

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