Exemplo n.º 1
0
        public static void ValidateDoesNotReturnErrorsForAttributesWithoutKnownValues()
        {
            var directive = new DirectiveWithAttributeProperty(
                new DirectiveBlockStart(10),
                new DirectiveName(14, "directive"),
                new[] { new Attribute(new AttributeName(27, "attribute"), new Equals(32), new DoubleQuote(33), new AttributeValue(34, "value"), new DoubleQuote(38)) },
                new BlockEnd(23));

            Assert.False(directive.Validate().Any());
        }
Exemplo n.º 2
0
        public static void GetAttributeNameReturnsValueOfAttributeWithGivenDisplayName()
        {
            var directive = new DirectiveWithAttributeProperty(
                new DirectiveBlockStart(0),
                new DirectiveName(4, "directive"),
                new[] { new Attribute(new AttributeName(13, "attribute"), new Equals(26), new DoubleQuote(27), new AttributeValue(28, "true"), new DoubleQuote(32)) },
                new BlockEnd(23));

            Assert.Equal("true", directive.GetAttributeValue("property"));
        }
Exemplo n.º 3
0
        public static void GetDescriptionReturnsStringSpecifiedInDescriptionAttributeForAttributeProperty()
        {
            var attribute = new Attribute(new AttributeName(13, "attribute"), new Equals(26), new DoubleQuote(27), new AttributeValue(28, "true"), new DoubleQuote(32));
            var directive = new DirectiveWithAttributeProperty(
                new DirectiveBlockStart(0),
                new DirectiveName(4, "directive"),
                new[] { attribute },
                new BlockEnd(23));
            DescriptionAttribute descriptionAttribute = directive.GetType().GetProperty("Property").GetCustomAttributes(false).OfType <DescriptionAttribute>().Single();
            string description;
            Span   applicableTo;

            Assert.True(directive.TryGetDescription(13, out description, out applicableTo));
            Assert.Equal(descriptionAttribute.Description, description);
            Assert.Equal(attribute.Span, applicableTo);
        }
Exemplo n.º 4
0
 public static void ValidateDoesNotReturnErrorsForAttributesWithoutKnownValues()
 {
     var directive = new DirectiveWithAttributeProperty(
         new DirectiveBlockStart(10),
         new DirectiveName(14, "directive"),
         new[] { new Attribute(new AttributeName(27, "attribute"), new Equals(32), new DoubleQuote(33), new AttributeValue(34, "value"), new DoubleQuote(38)) },
         new BlockEnd(23));
     Assert.False(directive.Validate().Any());
 }
Exemplo n.º 5
0
 public static void GetDescriptionReturnsStringSpecifiedInDescriptionAttributeForAttributeProperty()
 {
     var attribute = new Attribute(new AttributeName(13, "attribute"), new Equals(26), new DoubleQuote(27), new AttributeValue(28, "true"), new DoubleQuote(32));
     var directive = new DirectiveWithAttributeProperty(
         new DirectiveBlockStart(0),
         new DirectiveName(4, "directive"),
         new[] { attribute },
         new BlockEnd(23));
     DescriptionAttribute descriptionAttribute = directive.GetType().GetProperty("Property").GetCustomAttributes(false).OfType<DescriptionAttribute>().Single();
     string description;
     Span applicableTo;
     Assert.True(directive.TryGetDescription(13, out description, out applicableTo));
     Assert.Equal(descriptionAttribute.Description, description);
     Assert.Equal(attribute.Span, applicableTo);
 }
Exemplo n.º 6
0
 public static void GetAttributeNameReturnsValueOfAttributeWithGivenDisplayName()
 {
     var directive = new DirectiveWithAttributeProperty(
         new DirectiveBlockStart(0),
         new DirectiveName(4, "directive"),
         new[] { new Attribute(new AttributeName(13, "attribute"), new Equals(26), new DoubleQuote(27), new AttributeValue(28, "true"), new DoubleQuote(32)) },
         new BlockEnd(23));
     Assert.Equal("true", directive.GetAttributeValue("property"));
 }