Example #1
0
        private TypeScriptAnalyzer CreateTestSubject(
            IEslintBridgeAnalyzer eslintBridgeAnalyzer = null,
            ITsConfigProvider tsConfigProvider         = null,
            IRulesProvider rulesProvider           = null,
            IAnalysisStatusNotifier statusNotifier = null,
            ITelemetryManager telemetryManager     = null,
            ILogger logger = null)
        {
            statusNotifier ??= Mock.Of <IAnalysisStatusNotifier>();
            rulesProvider ??= Mock.Of <IRulesProvider>();
            logger ??= Mock.Of <ILogger>();
            tsConfigProvider ??= SetupTsConfigProvider();
            eslintBridgeAnalyzer ??= Mock.Of <IEslintBridgeAnalyzer>();
            telemetryManager ??= Mock.Of <ITelemetryManager>();

            var rulesProviderFactory = new Mock <IRulesProviderFactory>();

            rulesProviderFactory.Setup(x => x.Create("typescript")).Returns(rulesProvider);

            var eslintBridgeClient          = Mock.Of <ITypeScriptEslintBridgeClient>();
            var eslintBridgeAnalyzerFactory = new Mock <IEslintBridgeAnalyzerFactory>();

            eslintBridgeAnalyzerFactory
            .Setup(x => x.Create(rulesProvider, eslintBridgeClient))
            .Returns(eslintBridgeAnalyzer);

            return(new TypeScriptAnalyzer(eslintBridgeClient,
                                          rulesProviderFactory.Object,
                                          tsConfigProvider,
                                          statusNotifier,
                                          eslintBridgeAnalyzerFactory.Object,
                                          telemetryManager,
                                          logger));
        }
Example #2
0
        public TypeScriptAnalyzer(ITypeScriptEslintBridgeClient eslintBridgeClient,
                                  IRulesProviderFactory rulesProviderFactory,
                                  ITsConfigProvider tsConfigProvider,
                                  IAnalysisStatusNotifier analysisStatusNotifier,
                                  IEslintBridgeAnalyzerFactory eslintBridgeAnalyzerFactory,
                                  ITelemetryManager telemetryManager,
                                  ILogger logger)
        {
            this.tsConfigProvider       = tsConfigProvider;
            this.analysisStatusNotifier = analysisStatusNotifier;
            this.telemetryManager       = telemetryManager;
            this.logger = logger;

            var rulesProvider = rulesProviderFactory.Create("typescript");

            eslintBridgeAnalyzer = eslintBridgeAnalyzerFactory.Create(rulesProvider, eslintBridgeClient);
        }