public void TestSetup()
        {
            solution = CompilationHelper.GetSolutionFromText(Source);

            compilation = solution.Projects.First().GetCompilationAsync().Result;
            syntaxTree  = compilation.SyntaxTrees.First();
        }
コード例 #2
0
        public void TestSetup()
        {
            solution = CompilationHelper.GetSolutionFromText(Source);

            compilation = solution.Projects.First().GetCompilationAsync().Result;
            syntaxTree  = compilation.SyntaxTrees.First();

            ifMethod     = syntaxTree.GetRoot().DescendantNodes().OfType <MethodDeclarationSyntax>().First(m => m.Identifier.ValueText == "IfMethod");
            switchMethod = syntaxTree.GetRoot().DescendantNodes().OfType <MethodDeclarationSyntax>().First(m => m.Identifier.ValueText == "SwitchMethod");
        }
コード例 #3
0
        public void TestSetup()
        {
            solution = CompilationHelper.GetSolutionFromText(Source);

            compilation   = solution.Projects.First().GetCompilationAsync().Result;
            syntaxTree    = compilation.SyntaxTrees.First();
            semanticModel = compilation.GetSemanticModel(syntaxTree);

            methods = syntaxTree.GetRoot().DescendantNodes().OfType <MethodDeclarationSyntax>().ToList();
        }
コード例 #4
0
        public void DiagnosticRunnerTest_NoAnalyzer()
        {
            var runner = new DiagnosticsRunner(ImmutableArray.Create <DiagnosticAnalyzer>());

            var solution = CompilationHelper.GetSolutionFromText("");

            var compilation = solution.Projects.First().GetCompilationAsync().Result;

            var diagnosticsResult = runner.GetDiagnostics(compilation);

            diagnosticsResult.Should().HaveCount(0);
        }