Example #1
0
        public void TestElementWithParams()
        {
            var elem = new SsmlSayAs("words", SsmlSayAs.InterpretAsEnum.Character, SsmlSayAs.RoleEnum.Mdy);

            Assert.AreEqual(
                "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine +
                "<say-as interpret-as=\"character\" role=\"mdy\">words</say-as>",
                elem.ToString()
                );
        }
Example #2
0
        public void TestEmptyElement()
        {
            var elem = new SsmlSayAs();

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

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

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

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

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

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

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

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

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