public override void Visit(TagNode node)
 {
     debugString.Append('\t', indent);
     debugString.Append(node.ToString());
     debugString.AppendLine();
     indent++;
 }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 4
0
        public void TestSelfClosingSingularTag()
        {
            String expected = "<flavors/>";

            TagNode flavorsTag = new TagNode("flavors");

            Assert.AreEqual(expected, flavorsTag.ToString());
        }
Exemplo n.º 5
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            if (_tag != null)
            {
                _valueField.StringValue = _tag.ToString();
            }
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        public void TestCompositeTagoneChild()
        {
            String expected =
                "<product>" +
                "<price/>" +
                "</product>";

            TagNode productTag = new TagNode("product");

            productTag.Add(new TagNode("price"));

            Assert.AreEqual(expected, productTag.ToString());
        }
Exemplo n.º 8
0
        public EditValue (TagNode tag)
        {
            InitializeComponent();

            _tag = tag;

            if (tag == null) {
                DialogResult = DialogResult.Abort;
                Close();
                return;
            }

            textBox1.Text = _tag.ToString();
        }
Exemplo n.º 9
0
        public EditValue(TagNode tag)
        {
            InitializeComponent();

            _tag = tag;

            if (tag == null)
            {
                DialogResult = DialogResult.Abort;
                Close();
                return;
            }

            textBox1.Text = _tag.ToString();
        }
Exemplo n.º 10
0
        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());
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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());
        }
Exemplo n.º 13
0
        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");
        }
Exemplo n.º 14
0
        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");
        }
Exemplo n.º 15
0
        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());
 }
Exemplo n.º 17
0
        public void Should_Give_A_String_Representation()
        {
            var expected = "<parent gender='female'>Jennifer</parent>";

            Assert.AreEqual(expected, _tagNode.ToString());
        }