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() ); }
public void TestEmptyElement() { var elem = new SsmlLang(); Assert.AreEqual( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<lang></lang>", elem.ToString() ); }
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() ); }
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() ); }
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() ); }
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() ); }