Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);            
 }
Exemplo n.º 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);
        }
Exemplo n.º 15
0
 protected internal virtual void VisitAssemblyDirective(AssemblyDirective node)
 {
     this.VisitDirective(node);
 }
Exemplo n.º 16
0
 protected internal virtual void VisitAssemblyDirective(AssemblyDirective node)
 {
     this.VisitDirective(node);
 }