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