Пример #1
0
        public static void ValidateReturnsErrorWhenNameAttributeIsNotSpecified()
        {
            var           directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(4, "assembly"), new Attribute[0], new BlockEnd(23));
            TemplateError error     = directive.Validate().Single();

            Assert.Contains("Name", error.Message, StringComparison.OrdinalIgnoreCase);
        }
Пример #2
0
 public static void AcceptCallsVisitAssemblyDirectiveMethodOfSyntaxNodeVisitor()
 {
     var visitor = Substitute.For<SyntaxNodeVisitor>();
     var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(0, "assembly"), new Attribute[0], new BlockEnd(0));
     directive.Accept(visitor);
     visitor.Received().VisitAssemblyDirective(directive);
 }
Пример #3
0
 public static void GetDescriptionReturnsDescriptionOfTheDirective()
 {
     var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(4, "assembly"), new Attribute[0], new BlockEnd(23));
     string description;
     Span applicableTo;
     Assert.True(directive.TryGetDescription(4, out description, out applicableTo));
     Assert.StartsWith("Loads an assembly", description, StringComparison.OrdinalIgnoreCase);
 }
Пример #4
0
 public static void VisitAssemblyDirectiveCallsVisitDirectiveToAllowProcessingAllDirectivesPolymorphically()
 {
     var visitor = Substitute.ForPartsOf<SyntaxNodeVisitor>();
     var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(0, "assembly"), Enumerable.Empty<Attribute>(), new BlockEnd(0));
     visitor.VisitAssemblyDirective(directive);
     visitor.Received().VisitDirective(directive);
     Assert.Equal(typeof(Directive), typeof(AssemblyDirective).BaseType);
 }
Пример #5
0
        public static void AcceptCallsVisitAssemblyDirectiveMethodOfSyntaxNodeVisitor()
        {
            var visitor   = Substitute.For <SyntaxNodeVisitor>();
            var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(0, "assembly"), new Attribute[0], new BlockEnd(0));

            directive.Accept(visitor);
            visitor.Received().VisitAssemblyDirective(directive);
        }
Пример #6
0
 public static void AssemblyNameReturnsValueOfNameAttribute()
 {
     var directive = new AssemblyDirective(
         new DirectiveBlockStart(0),
         new DirectiveName(4, "assembly"),
         new[] { new Attribute(new AttributeName(13, "name"), new Equals(17), new DoubleQuote(18), new AttributeValue(19, "42"), new DoubleQuote(21)) },
         new BlockEnd(23));
     Assert.Equal("42", directive.AssemblyName);
 }
Пример #7
0
        public static void GetDescriptionReturnsDescriptionOfTheDirective()
        {
            var    directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(4, "assembly"), new Attribute[0], new BlockEnd(23));
            string description;
            Span   applicableTo;

            Assert.True(directive.TryGetDescription(4, out description, out applicableTo));
            Assert.StartsWith("Loads an assembly", description, StringComparison.OrdinalIgnoreCase);
        }
Пример #8
0
        public static void VisitAssemblyDirectiveCallsVisitDirectiveToAllowProcessingAllDirectivesPolymorphically()
        {
            var visitor   = Substitute.ForPartsOf <SyntaxNodeVisitor>();
            var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(0, "assembly"), Enumerable.Empty <Attribute>(), new BlockEnd(0));

            visitor.VisitAssemblyDirective(directive);
            visitor.Received().VisitDirective(directive);
            Assert.Equal(typeof(Directive), typeof(AssemblyDirective).BaseType);
        }
Пример #9
0
        public static void AssemblyNameReturnsValueOfNameAttribute()
        {
            var directive = new AssemblyDirective(
                new DirectiveBlockStart(0),
                new DirectiveName(4, "assembly"),
                new[] { new Attribute(new AttributeName(13, "name"), new Equals(17), new DoubleQuote(18), new AttributeValue(19, "42"), new DoubleQuote(21)) },
                new BlockEnd(23));

            Assert.Equal("42", directive.AssemblyName);
        }
Пример #10
0
 public static void GetDescriptionReturnsDescriptionOfTheNameAttribute()
 {
     var directive = new AssemblyDirective(
         new DirectiveBlockStart(0),
         new DirectiveName(4, "assembly"),
         new[] { new Attribute(new AttributeName(13, "name"), new Equals(17), new DoubleQuote(18), new AttributeValue(19, "42"), new DoubleQuote(21)) },
         new BlockEnd(23));
     string description;
     Span applicableTo;
     Assert.True(directive.TryGetDescription(13, out description, out applicableTo));
     Assert.StartsWith("Name of an assembly", description, StringComparison.OrdinalIgnoreCase);
 }
Пример #11
0
        public static void GetDescriptionReturnsDescriptionOfTheNameAttribute()
        {
            var directive = new AssemblyDirective(
                new DirectiveBlockStart(0),
                new DirectiveName(4, "assembly"),
                new[] { new Attribute(new AttributeName(13, "name"), new Equals(17), new DoubleQuote(18), new AttributeValue(19, "42"), new DoubleQuote(21)) },
                new BlockEnd(23));
            string description;
            Span   applicableTo;

            Assert.True(directive.TryGetDescription(13, out description, out applicableTo));
            Assert.StartsWith("Name of an assembly", description, StringComparison.OrdinalIgnoreCase);
        }
Пример #12
0
 public static void ValidateReturnsErrorWhenNameAttributeIsNotSpecified()
 {
     var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(4, "assembly"), new Attribute[0], new BlockEnd(23));
     TemplateError error = directive.Validate().Single();
     Assert.Contains("Name", error.Message, StringComparison.OrdinalIgnoreCase);
 }
Пример #13
0
 public static void AssemblyNameReturnsEmptyStringWhenNameAttributeIsNotSpecified()
 {
     var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(4, "assembly"), new Attribute[0], new BlockEnd(23));
     Assert.Equal(string.Empty, directive.AssemblyName);            
 }
Пример #14
0
        public static void AssemblyNameReturnsEmptyStringWhenNameAttributeIsNotSpecified()
        {
            var directive = new AssemblyDirective(new DirectiveBlockStart(0), new DirectiveName(4, "assembly"), new Attribute[0], new BlockEnd(23));

            Assert.Equal(string.Empty, directive.AssemblyName);
        }
Пример #15
0
 protected internal virtual void VisitAssemblyDirective(AssemblyDirective node)
 {
     this.VisitDirective(node);
 }
Пример #16
0
 protected internal virtual void VisitAssemblyDirective(AssemblyDirective node)
 {
     this.VisitDirective(node);
 }