Exemplo n.º 1
0
        public void Method_with_same_type_params_invoked_with_positional_args_triggers_diagnostic()
        {
            const string testCodeSnippet = @"
                namespace Frobnitz
                {
                    class Wombat
                    {
                        void Gork(string fileName, int line, int column) {}
                        void Bork()
                        {
                            Gork(""Gizmo.cs"", 9000, 1);
                        }
                    }
                }
            ";

            var expectedDiagnostic = UseNamedArgumentsDiagnosticResult.Create(
                "Gork",
                new [] { new [] { "line", "column" } },
                new DiagnosticResultLocation("Test0.cs", line: 9, column: 29));

            UseNamedArgsCSharpAnalyzerRunner.InvokeAndVerifyDiagnostic(testCodeSnippet, expectedDiagnostic);
        }
Exemplo n.º 2
0
            /// <summary>
            /// No diagnostics expected to show up for <paramref name="codeSnippet" />
            /// </summary>
            public static void EmptyDiagnosticsFor(string codeSnippet)
            {
                var emptyExpectedDiagnostics = UseNamedArgumentsDiagnosticResult.EmptyExpectedDiagnostics;

                UseNamedArgsCSharpAnalyzerRunner.InvokeAndVerifyDiagnostic(codeSnippet, emptyExpectedDiagnostics);
            }