public void SyntaxReceiver_finds_root_class_via_interface(bool useVB)
        {
            var(source, expectedType) = useVB
                     ? (vbSource, typeof(VB.ClassBlockSyntax))
                     : (cSharpSource, typeof(CSharp.ClassDeclarationSyntax));
            var receiver          = Utils.Receiver(useVB);
            var classDeclarations = Utils.ClassDeclarations(useVB, source);

            receiver = VisitSyntaxNodes(receiver, classDeclarations);

            receiver.Candidates.Should().HaveCount(1);
            var poco = receiver.Candidates.First();

            poco.Should().BeOfType(expectedType);
            GetName(useVB, poco).Should().Be("CliRoot");
        }
        public void SyntaxReceiver_finds_root_class_in_generic(bool useVB)
        {
            var(source, expectedType) = useVB
                     ? (vbSource, typeof(VB.IdentifierNameSyntax))
                     : (cSharpSource, typeof(CSharp.IdentifierNameSyntax));
            var receiver      = Utils.Receiver(useVB);
            var statementList = Utils.StatementsForMethod(useVB, source, "Main");

            statementList.Should().NotBeNull();
            var statements = statementList.ToArray();

            receiver.OnVisitSyntaxNode(statements[0].ChildNodes().First());

            receiver.Candidates.Should().HaveCount(1);
            var poco = receiver.Candidates.First();

            poco.Should().BeOfType(expectedType);
            GetName(useVB, poco).Should().Be("CliRoot");
        }
        public void SyntaxReceiver_finds_entry_method_in_another_class(bool useVB)
        {
            var(source, expectedType) = useVB
                     ? (vbSource, typeof(VB.ClassBlockSyntax))
                     : (cSharpSource, typeof(CSharp.ClassDeclarationSyntax));
            var receiver      = Utils.Receiver(useVB);
            var statementList = Utils.StatementsForMethod(useVB, source, "Main");

            statementList.Should().NotBeNull();
            var statements = statementList.ToArray();

            receiver.OnVisitSyntaxNode(statements[2].ChildNodes().First());

            receiver.Candidates.Should().HaveCount(1);
            if (useVB)
            {
                var methodType = receiver.Candidates.First() as VB.MemberAccessExpressionSyntax;
                methodType.Should().NotBeNull();
                var classIdentifier  = methodType !.Expression as VB.IdentifierNameSyntax;
                var methodIdentifier = methodType.Name as VB.IdentifierNameSyntax;
                classIdentifier.Should().NotBeNull();
                methodIdentifier.Should().NotBeNull();
                classIdentifier !.Identifier.ValueText.Should().Be("A");
                methodIdentifier !.Identifier.ValueText.Should().Be("RunThatMethod");
            }
            else
            {
                var methodType = receiver.Candidates.First() as CSharp.MemberAccessExpressionSyntax;
                methodType.Should().NotBeNull();
                var classIdentifier  = methodType !.Expression as CSharp.IdentifierNameSyntax;
                var methodIdentifier = methodType.Name as CSharp.IdentifierNameSyntax;
                classIdentifier.Should().NotBeNull();
                methodIdentifier.Should().NotBeNull();
                classIdentifier !.Identifier.ValueText.Should().Be("A");
                methodIdentifier !.Identifier.ValueText.Should().Be("RunThatMethod");
            }
        }