예제 #1
0
        public static void ValidateIgnoresCaseWhenComparingAttributeValuesToKnownValues()
        {
            var directive = new DirectiveWithKnownAttributeValues(
                new DirectiveBlockStart(0),
                new DirectiveName(4, "directive"),
                new[] { new Attribute(new AttributeName(13, "attributeWithKnownValues"), new Equals(37), new DoubleQuote(38), new AttributeValue(39, "KNOWNVALUE"), new DoubleQuote(49)) },
                new BlockEnd(51));

            Assert.False(directive.Validate().Any());
        }
예제 #2
0
        public static void ValidateReturnsTemplateErrorWhenAttributeValueDoesNotMatchKnownValues()
        {
            AttributeValue value;
            var            directive = new DirectiveWithKnownAttributeValues(
                new DirectiveBlockStart(0),
                new DirectiveName(4, "directive"),
                new[] { new Attribute(new AttributeName(13, "attributeWithKnownValues"), new Equals(37), new DoubleQuote(38), value = new AttributeValue(39, "wrong"), new DoubleQuote(44)) },
                new BlockEnd(46));
            TemplateError error = directive.Validate().Single();

            Assert.Contains("attributeWithKnownValues", error.Message, StringComparison.OrdinalIgnoreCase);
            Assert.Contains("wrong", error.Message, StringComparison.OrdinalIgnoreCase);
            Assert.Equal(value.Span, error.Span);
            Assert.Equal(value.Position, error.Position);
        }
예제 #3
0
 public static void ValidateIgnoresCaseWhenComparingAttributeValuesToKnownValues()
 {
     var directive = new DirectiveWithKnownAttributeValues(
         new DirectiveBlockStart(0), 
         new DirectiveName(4, "directive"), 
         new[] { new Attribute(new AttributeName(13, "attributeWithKnownValues"), new Equals(37), new DoubleQuote(38), new AttributeValue(39, "KNOWNVALUE"), new DoubleQuote(49)) },
         new BlockEnd(51));
     Assert.False(directive.Validate().Any());            
 }
예제 #4
0
 public static void ValidateReturnsTemplateErrorWhenAttributeValueDoesNotMatchKnownValues()
 {
     AttributeValue value;
     var directive = new DirectiveWithKnownAttributeValues(
         new DirectiveBlockStart(0), 
         new DirectiveName(4, "directive"), 
         new[] { new Attribute(new AttributeName(13, "attributeWithKnownValues"), new Equals(37), new DoubleQuote(38), value = new AttributeValue(39, "wrong"), new DoubleQuote(44)) },
         new BlockEnd(46));
     TemplateError error = directive.Validate().Single();
     Assert.Contains("attributeWithKnownValues", error.Message, StringComparison.OrdinalIgnoreCase);
     Assert.Contains("wrong", error.Message, StringComparison.OrdinalIgnoreCase);
     Assert.Equal(value.Span, error.Span);
     Assert.Equal(value.Position, error.Position);
 }