public void CreateXmlMarkupObjectWithCustomIndent() { var sb = new StringBuilder(); dynamic xmlMarkup = new XmlMarkup(ref sb, 5); Assert.AreEqual(5, xmlMarkup.Indent); }
public void CanAssignValueToAnyXmlTagWithWords() { var sb = new StringBuilder(); dynamic xmlMarkup = new XmlMarkup(ref sb); xmlMarkup.TestTag("TestValue"); Assert.AreEqual("<TestTag>TestValue</TestTag>", sb.ToString()); }
public void CanAssignAttrubtesToTagByAnonymousObjectWithValue() { var sb = new StringBuilder(); dynamic xmlMarkup = new XmlMarkup(ref sb); xmlMarkup.TestTag("TestValue", new {firstAttribute = "AttributeValue"}); Assert.AreEqual("<TestTag firstAttribute=\"AttributeValue\">TestValue</TestTag>", sb.ToString()); }
public void AssigningNoValueToAnyXmlTagCreatesEmptyTag() { var sb = new StringBuilder(); dynamic xmlMarkup = new XmlMarkup(ref sb); xmlMarkup.TestTag(); Assert.AreEqual("<TestTag></TestTag>", sb.ToString()); }
public void CallToCommentShouldEncloseGivenTextInComment() { var sb = new StringBuilder(); dynamic xmlMarkup = new XmlMarkup(ref sb); xmlMarkup.Comment_("This is a comment"); Assert.AreEqual("<!--This is a comment-->", sb.ToString()); }
public void CreateXmlMarkupObjectWithStringBuilderChangesApplyToBoth() { var sb = new StringBuilder(); dynamic xmlMarkup = new XmlMarkup(ref sb); sb.Append("Test string"); Assert.AreEqual(sb, xmlMarkup.Target); }
public void CanAddNestedTagsWithUsingClause() { var sb = new StringBuilder(); dynamic xmlMarkup = new XmlMarkup(ref sb); using (xmlMarkup.Family()) { xmlMarkup.Child("Bob"); xmlMarkup.Child("Tom"); xmlMarkup.Child("Jerry"); } var lines = sb.ToString().Split(Environment.NewLine.ToCharArray()); Assert.AreEqual("<Family>", lines[0]); Assert.AreEqual(" <Child>Bob</Child>", lines[1]); Assert.AreEqual(" <Child>Tom</Child>", lines[2]); Assert.AreEqual(" <Child>Jerry</Child>", lines[3]); Assert.AreEqual("</Family>", lines[4]); }