Ejemplo n.º 1
0
        public void VBNetSimpleEmptyElementWithAttributesTest()
        {
            XmlElementExpression element = ParseUtil.ParseExpression <XmlElementExpression>("<Test id='0' name=<%= name %> <%= contentData %> />");

            Assert.IsFalse(element.NameIsExpression);
            Assert.AreEqual("Test", element.XmlName);
            Assert.IsNotEmpty(element.Attributes);
            Assert.AreEqual(3, element.Attributes.Count);

            Assert.IsTrue(element.Attributes[0] is XmlAttributeExpression);
            XmlAttributeExpression attribute = element.Attributes[0] as XmlAttributeExpression;

            Assert.AreEqual("id", attribute.Name);
            Assert.IsTrue(attribute.IsLiteralValue);
            Assert.IsTrue(attribute.ExpressionValue.IsNull);
            Assert.AreEqual("0", attribute.LiteralValue);
            Assert.AreEqual(new Location(7, 1), attribute.StartLocation);
            Assert.AreEqual(new Location(13, 1), attribute.EndLocation);

            Assert.IsTrue(element.Attributes[1] is XmlAttributeExpression);
            XmlAttributeExpression attribute2 = element.Attributes[1] as XmlAttributeExpression;

            Assert.AreEqual("name", attribute2.Name);
            Assert.IsFalse(attribute2.IsLiteralValue);
            Assert.IsFalse(attribute2.ExpressionValue.IsNull);

            Assert.IsTrue(attribute2.ExpressionValue is IdentifierExpression);
            IdentifierExpression identifier = attribute2.ExpressionValue as IdentifierExpression;

            Assert.AreEqual("name", identifier.Identifier);
            Assert.AreEqual(new Location(23, 1), identifier.StartLocation);
            Assert.AreEqual(new Location(27, 1), identifier.EndLocation);

            Assert.AreEqual(new Location(14, 1), attribute2.StartLocation);
            Assert.AreEqual(new Location(30, 1), attribute2.EndLocation);

            Assert.IsTrue(element.Attributes[2] is XmlEmbeddedExpression);
            XmlEmbeddedExpression attribute3 = element.Attributes[2] as XmlEmbeddedExpression;

            Assert.IsTrue(attribute3.InlineVBExpression is IdentifierExpression);
            IdentifierExpression identifier2 = attribute3.InlineVBExpression as IdentifierExpression;

            Assert.AreEqual("contentData", identifier2.Identifier);
            Assert.AreEqual(new Location(35, 1), identifier2.StartLocation);
            Assert.AreEqual(new Location(46, 1), identifier2.EndLocation);

            Assert.AreEqual(new Location(31, 1), attribute3.StartLocation);
            Assert.AreEqual(new Location(49, 1), attribute3.EndLocation);

            Assert.IsEmpty(element.Children);
            Assert.AreEqual(new Location(1, 1), element.StartLocation);
            Assert.AreEqual(new Location(52, 1), element.EndLocation);
        }
Ejemplo n.º 2
0
 public virtual object VisitXmlEmbeddedExpression(XmlEmbeddedExpression xmlEmbeddedExpression, object data)
 {
     throw new global::System.NotImplementedException("XmlEmbeddedExpression");
 }
Ejemplo n.º 3
0
 public object VisitXmlEmbeddedExpression(XmlEmbeddedExpression xmlEmbeddedExpression, object data)
 {
     throw new NotImplementedException();
 }