public override void Visit(TagNode node) { debugString.Append('\t', indent); debugString.Append(node.ToString()); debugString.AppendLine(); indent++; }
public void TestOneNodeTree() { string expectedResult = "<orders></orders>"; TagNode orders = new TagNode("orders"); Assert.Equal(orders.ToString(), expectedResult); }
public static string GetTagNodeText(TagNode tag) { if (tag == null) return null; switch (tag.GetTagType()) { case TagType.TAG_BYTE: case TagType.TAG_SHORT: case TagType.TAG_INT: case TagType.TAG_LONG: case TagType.TAG_FLOAT: case TagType.TAG_DOUBLE: case TagType.TAG_STRING: return tag.ToString(); case TagType.TAG_BYTE_ARRAY: return tag.ToTagByteArray().Length + " bytes"; case TagType.TAG_LIST: return tag.ToTagList().Count + " entries"; case TagType.TAG_COMPOUND: return tag.ToTagCompound().Count + " entries"; } return null; }
public void TestSelfClosingSingularTag() { String expected = "<flavors/>"; TagNode flavorsTag = new TagNode("flavors"); Assert.AreEqual(expected, flavorsTag.ToString()); }
public override void AwakeFromNib() { base.AwakeFromNib(); if (_tag != null) { _valueField.StringValue = _tag.ToString(); } }
public void TestAddChildrenToTree() { string expectedResult = "<orders><order><item></item></order></orders>"; TagNode orders = new TagNode("orders"); TagNode order = new TagNode("order"); TagNode item = new TagNode("item"); order.Add(item); orders.Add(order); Assert.Equal(orders.ToString(), expectedResult); }
public void TestCompositeTagoneChild() { String expected = "<product>" + "<price/>" + "</product>"; TagNode productTag = new TagNode("product"); productTag.Add(new TagNode("price")); Assert.AreEqual(expected, productTag.ToString()); }
public EditValue (TagNode tag) { InitializeComponent(); _tag = tag; if (tag == null) { DialogResult = DialogResult.Abort; Close(); return; } textBox1.Text = _tag.ToString(); }
public EditValue(TagNode tag) { InitializeComponent(); _tag = tag; if (tag == null) { DialogResult = DialogResult.Abort; Close(); return; } textBox1.Text = _tag.ToString(); }
public void TestSimpleTagWithOneAttributeAndValue() { var expected = "<price currency=" + "'" + "USD" + "'>" + SamplePrice + "</price>"; TagNode priceTag = new TagNode("price"); priceTag.AddAttribute("currency", "USD"); priceTag.AddValue(SamplePrice); Assert.AreEqual(expected, priceTag.ToString()); }
public void TestAddAttributesAndValuesToTree() { string expectedResult = "<orders><order><item quantity='1' number='1234'>" + "DogHouse</item></order></orders>"; TagNode orders = new TagNode("orders"); TagNode order = new TagNode("order"); TagNode item = new TagNode("item"); item.AddAttributes("quantity", "1"); item.AddAttributes("number", "1234"); item.SetValue("DogHouse"); order.Add(item); orders.Add(order); Assert.Equal(orders.ToString(), expectedResult); }
public void TestAddingChildrenAndGrandChildren() { String expected = "<orders>" + "<order>" + "<product/>" + "</order>" + "</orders>"; TagNode ordersTag = new TagNode("orders"); TagNode orderTag = new TagNode("order"); orderTag.Add(new TagNode("product")); ordersTag.Add(orderTag); Assert.AreEqual(expected, ordersTag.ToString()); }
public void Test_CompositeTag_OneChild() { // Arrange String expected = "<product>" + "<price>" + "</price>" + "</product>"; // Act TagNode productTag = new TagNode("product"); productTag.Add(new TagNode("price")); // Assert Assert.AreEqual(expected, productTag.ToString(), "price XML"); }
public void Test_SimpleTag_WithOneAttribute_And_Value() { // Arrange String expected = "<price currency=" + "'" + "USD" + "'>" + SAMPLE_PRICE + "</price>"; // Act TagNode priceTag = new TagNode("price"); priceTag.AddAttribute("currency", "USD"); priceTag.AddValue(SAMPLE_PRICE); // Assert Assert.AreEqual(expected, priceTag.ToString(), "price XML"); }
public void Test_AddingChildren_And_GrandChildren() { // Arrange String expected = "<orders>" + "<order>" + "<product>" + "</product>" + "</order>" + "</orders>"; // Act TagNode ordersTag = new TagNode("orders"); TagNode orderTag = new TagNode("order"); TagNode productTag = new TagNode("product"); ordersTag.Add(orderTag); orderTag.Add(productTag); // Assert Assert.AreEqual(expected, ordersTag.ToString(), "price XML"); }
public string ToXml() { return(_rootNode.ToString()); }
public void Should_Give_A_String_Representation() { var expected = "<parent gender='female'>Jennifer</parent>"; Assert.AreEqual(expected, _tagNode.ToString()); }