コード例 #1
0
        public void AssignAsyncVoidLambdaToAction_TestCodeFix(string oldAssertion, string newAssertion)
        {
            var oldSource = GenerateCode.AsyncFunctionStatement(oldAssertion);
            var newSource = GenerateCode.AsyncFunctionStatement(newAssertion);

            DiagnosticVerifier.VerifyCSharpFix <AsyncVoidCodeFix, AsyncVoidAnalyzer>(oldSource, newSource);
        }
コード例 #2
0
        public void AssignVoidLambdaToAction_TestAnalyzer()
        {
            const string statement = "Action action = () => {};";
            var          source    = GenerateCode.AsyncFunctionStatement(statement);

            DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source);
        }
コード例 #3
0
        public void AssignAsyncVoidLambdaToAction_TestAnalyzer(string assertion)
        {
            var source = GenerateCode.AsyncFunctionStatement(assertion);

            DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source, new DiagnosticResult
            {
                Id        = AsyncVoidAnalyzer.DiagnosticId,
                Message   = AsyncVoidAnalyzer.Message,
                Locations = new DiagnosticResultLocation[]
                {
                    new DiagnosticResultLocation("Test0.cs", 10, 13)
                },
                Severity = DiagnosticSeverity.Warning
            });
        }