public void TestGlobalType(
            [StandardFactory(SummaryComments)] SummaryComment summary,
            [StandardFactory(AllObjectTypes)] string outerType,
            [StandardFactory(GlobalAccessLevels)] AccessLevelInfo accessLevel)
        {
            string source = $@"
{summary.Text}
{accessLevel.Keyword} {outerType} Test {{ }}";

            if (summary.ExpectsDiagnostic && accessLevel.RequiresSummary)
            {
                int line   = 2 + summary.LineLength + 1;
                int column = accessLevel.Keyword.Length + 1 + outerType.Length + 2;

                VerifyCSharpDiagnostic(source,
                                       new DiagnosticResult
                {
                    Id        = "REVIEW" + ((int)DiagnosticId.MissingOrEmptySummary).ToString("D5"),
                    Message   = string.Format(summary.ExpectedMessageFmt, outerType, "Test"),
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] {
                        new DiagnosticResultLocation("Test0.cs", line, column)
                    },
                });
            }
            else
            {
                VerifyCSharpDiagnostic(source);
            }
        }
        public void TestInterfacePropertyDeclaration(
            [StandardFactory(SummaryComments)] SummaryComment summary,
            [StandardFactory(GlobalAccessLevels)] AccessLevelInfo outerAccessLevel)
        {
            string source = $@"
/// <summary>
/// no diagnostic here!
/// </summary>
{outerAccessLevel.Keyword} interface Outer
{{
    {summary.Text}
    int Test {{ get; }}
}}";

            if (summary.ExpectsDiagnostic && outerAccessLevel.RequiresSummary)
            {
                int line = 7 + summary.LineLength + 1;

                VerifyCSharpDiagnostic(source,
                                       new DiagnosticResult
                {
                    Id        = "REVIEW" + ((int)DiagnosticId.MissingOrEmptySummary).ToString("D5"),
                    Message   = string.Format(summary.ExpectedMessageFmt, "property", "Test"),
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] {
                        new DiagnosticResultLocation("Test0.cs", line, 9)
                    },
                });
            }
            else
            {
                VerifyCSharpDiagnostic(source);
            }
        }
        public void TestMembersOfGlobalEnum(
            [StandardFactory(SummaryComments)] SummaryComment summary,
            [StandardFactory(GlobalAccessLevels)] AccessLevelInfo accessLevel)
        {
            string source = $@"
/// <summary>
/// no diagnostic here!
/// </summary>
{accessLevel.Keyword} enum Program
{{
    {summary.Text}
    Test,
}}";

            if (summary.ExpectsDiagnostic && accessLevel.RequiresSummary)
            {
                int line = 7 + summary.LineLength + 1;

                VerifyCSharpDiagnostic(source,
                                       new DiagnosticResult
                {
                    Id        = "REVIEW" + ((int)DiagnosticId.MissingOrEmptySummary).ToString("D5"),
                    Message   = string.Format(summary.ExpectedMessageFmt, "enum member", "Test"),
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] {
                        new DiagnosticResultLocation("Test0.cs", line, 5)
                    },
                });
            }
            else
            {
                VerifyCSharpDiagnostic(source);
            }
        }
        public void TestEventPropertyDeclaration(
            [StandardFactory(SummaryComments)] SummaryComment summary,
            [StandardFactory(ClassTypes)] string outerType,
            [StandardFactory(GlobalAccessLevels)] AccessLevelInfo outerAccessLevel,
            [StandardFactory(MemberAccessLevels)] AccessLevelInfo eventAccessLevel)
        {
            string source = $@"
/// <summary>
/// no diagnostic here!
/// </summary>
{outerAccessLevel.Keyword} {outerType} Outer
{{
    {summary.Text}
    {eventAccessLevel.Keyword} event EventHandler Test
    {{
        add {{ }}
        remove {{ }}
    }}
}}";

            if (summary.ExpectsDiagnostic && outerAccessLevel.RequiresSummary && eventAccessLevel.RequiresSummary)
            {
                int line   = 7 + summary.LineLength + 1;
                int column = 4 + eventAccessLevel.Keyword.Length + 21;

                VerifyCSharpDiagnostic(source,
                                       new DiagnosticResult
                {
                    Id        = "REVIEW" + ((int)DiagnosticId.MissingOrEmptySummary).ToString("D5"),
                    Message   = string.Format(summary.ExpectedMessageFmt, "event", "Test"),
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] {
                        new DiagnosticResultLocation("Test0.cs", line, column)
                    },
                });
            }
            else
            {
                VerifyCSharpDiagnostic(source);
            }
        }
        public void TestClassAndStructMethodDeclaration(
            [StandardFactory(SummaryComments)] SummaryComment summary,
            [StandardFactory(ClassTypes)] string outerType,
            [StandardFactory(GlobalAccessLevels)] AccessLevelInfo typeAccessLevel,
            [StandardFactory(MemberAccessLevels)] AccessLevelInfo methodAccessLevel)
        {
            string source = $@"
/// <summary>
/// no diagnostic here!
/// </summary>
{typeAccessLevel.Keyword} {outerType} Program
{{
    {summary.Text}
    {methodAccessLevel.Keyword} void Test() {{ }}
}}";

            if (summary.ExpectsDiagnostic && typeAccessLevel.RequiresSummary && methodAccessLevel.RequiresSummary)
            {
                int line   = 7 + summary.LineLength + 1;
                int column = 4 + methodAccessLevel.Keyword.Length + 7;

                VerifyCSharpDiagnostic(source,
                                       new DiagnosticResult
                {
                    Id        = "REVIEW" + ((int)DiagnosticId.MissingOrEmptySummary).ToString("D5"),
                    Message   = string.Format(summary.ExpectedMessageFmt, "method", "Test"),
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] {
                        new DiagnosticResultLocation("Test0.cs", line, column)
                    },
                });
            }
            else
            {
                VerifyCSharpDiagnostic(source);
            }
        }
        public void TestClassAndStructConversionOperator(
            [StandardFactory(SummaryComments)] SummaryComment summary,
            [StandardFactory(GlobalAccessLevels)] AccessLevelInfo outerAccessLevel,
            [StandardFactory(ClassTypes)] string outerType,
            [StandardFactory(ExplicitImplicit)] string explicitness)
        {
            string source = $@"
/// <summary>
/// no diagnostic here!
/// </summary>
{outerAccessLevel.Keyword} {outerType} Program
{{
    {summary.Text}
    public static {explicitness} operator int(Program noSummary) {{ return 0; }}
}}";

            if (summary.ExpectsDiagnostic && outerAccessLevel.RequiresSummary)
            {
                int line   = 7 + summary.LineLength + 1;
                int column = 18 + explicitness.Length + 2;

                VerifyCSharpDiagnostic(source,
                                       new DiagnosticResult
                {
                    Id        = "REVIEW" + ((int)DiagnosticId.MissingOrEmptySummary).ToString("D5"),
                    Message   = string.Format(summary.ExpectedMessageFmt, string.Empty, "operator int"),
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] {
                        new DiagnosticResultLocation("Test0.cs", line, column)
                    },
                });
            }
            else
            {
                VerifyCSharpDiagnostic(source);
            }
        }
        public void TestBinaryOperatorDeclaration(
            [StandardFactory(SummaryComments)] SummaryComment summary,
            [StandardFactory(ClassTypes)] string outerType,
            [StandardFactory(GlobalAccessLevels)] AccessLevelInfo outerAccessLevel,
            [StandardFactory(OverloadableBinaryOperators)] OperatorInfo operatorInfo)
        {
            string source = $@"
/// <summary>
/// no diagnostic here!
/// </summary>
{outerAccessLevel.Keyword} {outerType} Outer
{{
    {summary.Text}
    public static bool operator {operatorInfo.Token}(Outer noSummary, int i) {{ return false; }}
}}";

            if (summary.ExpectsDiagnostic && outerAccessLevel.RequiresSummary)
            {
                int line = 7 + summary.LineLength + 1;

                VerifyCSharpDiagnostic(source,
                                       new DiagnosticResult
                {
                    Id        = "REVIEW" + ((int)DiagnosticId.MissingOrEmptySummary).ToString("D5"),
                    Message   = string.Format(summary.ExpectedMessageFmt, "operator", operatorInfo.Token),
                    Severity  = DiagnosticSeverity.Warning,
                    Locations = new[] {
                        new DiagnosticResultLocation("Test0.cs", line, 24)
                    },
                });
            }
            else
            {
                VerifyCSharpDiagnostic(source);
            }
        }