Ejemplo n.º 1
0
        public void RequestAnalysis_NotSupported_RequestAnalysisNotCalled()
        {
            // Arrange
            var analyzers = new DummyAnalyzer[]
            {
                new DummyAnalyzer(),
                new DummyAnalyzer(AnalysisLanguage.CFamily),
                new DummyAnalyzer(),
            };

            var controller = new AnalyzerController(new TestLogger(), analyzers, null);

            // Act
            controller.ExecuteAnalysis("c:\\file.cpp", "charset1", new[] { AnalysisLanguage.Javascript }, null, null, CancellationToken.None);

            analyzers.Any(x => x.RequestAnalysisCalled).Should().BeFalse();
        }
Ejemplo n.º 2
0
        public void RequestAnalysis_Supported_RequestAnalysisNotCalled()
        {
            // Arrange
            var analyzers = new DummyAnalyzer[]
            {
                new DummyAnalyzer(),
                new DummyAnalyzer(AnalysisLanguage.CFamily),
                new DummyAnalyzer(),
                new DummyAnalyzer(AnalysisLanguage.CFamily),
            };

            var controller = new AnalyzerController(new TestLogger(), analyzers, null);

            // Act
            controller.ExecuteAnalysis("c:\\file.cpp", "charset1",
                                       new[] { AnalysisLanguage.CFamily, AnalysisLanguage.Javascript }, null, null, CancellationToken.None);

            analyzers[0].RequestAnalysisCalled.Should().BeFalse();
            analyzers[2].RequestAnalysisCalled.Should().BeFalse();

            // Both analyzers that support analysis should be given the chance to handle the request.
            analyzers[1].RequestAnalysisCalled.Should().BeTrue();
            analyzers[3].RequestAnalysisCalled.Should().BeTrue();
        }