Example #1
0
        public void ParseAttributeTest()
        {
            //Parse tokens
            MarkupParser markupParser    = new MarkupParser(Init("#id1"));
            Attribute    parsedAttribute = markupParser.ParseAttribute();

            //Check attribute
            Assert.AreEqual(typeof(IdAttribute), parsedAttribute.GetType());

            //Check id attribute
            Assert.AreEqual("#id1", parsedAttribute.ToString());
        }
Example #2
0
        public void ParseDesignatorWithAttributeTest()
        {
            //Parse tokens
            MarkupParser markupParser     = new MarkupParser(Init("img@100%50"));
            Designator   parsedDesignator = markupParser.ParseDesignator();

            //Check designator
            Assert.AreEqual("img", parsedDesignator.GetIdentifier());
            Assert.AreEqual(1, parsedDesignator.GetAttributes().Count);

            //Check attribute
            Attribute parsedAttribute = (Attribute)parsedDesignator.GetAttributes().Get(0);

            Assert.AreEqual(typeof(Width_HeightAttribute), parsedAttribute.GetType());

            //Check Width_HeightAttribute contents
            Width_HeightAttribute attribute = (Width_HeightAttribute)parsedAttribute;

            Assert.AreEqual(100, attribute.GetWidth());
            Assert.AreEqual(50, attribute.GetHeight());
        }