public void TestEmptyElement() { var elem = new Hangup(); Assert.AreEqual( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<Hangup></Hangup>", elem.ToString() ); }
public void TestElementWithTextNode() { var elem = new Hangup(); elem.AddText("Here is the content"); Assert.AreEqual( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<Hangup>Here is the content</Hangup>", elem.ToString() ); }
public void TestElementWithExtraAttributes() { var elem = new Hangup(); elem.SetOption("newParam1", "value"); elem.SetOption("newParam2", 1); Assert.AreEqual( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<Hangup newParam1=\"value\" newParam2=\"1\"></Hangup>", elem.ToString() ); }
public void TestMixedContent() { var elem = new Hangup(); elem.AddText("before") .AddChild("Child").AddText("content"); elem.AddText("after"); Assert.AreEqual( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<Hangup>before<Child>content</Child>after</Hangup>", elem.ToString() ); }
public void TestAllowGenericChildNodes() { var elem = new Hangup(); elem.AddChild("generic-tag").AddText("Content").SetOption("tag", true); Assert.AreEqual( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine + "<Hangup>" + Environment.NewLine + " <generic-tag tag=\"True\">Content</generic-tag>" + Environment.NewLine + "</Hangup>", elem.ToString() ); }