public void TestInitialize()
        {
            this.monitorSelection = KnownUIContextsAccessor.MonitorSelectionService;

            this.serviceProvider = new ConfigurableServiceProvider();
            this.serviceProvider.RegisterService(typeof(DTE), this.dte = new DTEMock());
            this.serviceProvider.RegisterService(typeof(SComponentModel), 
                ConfigurableComponentModel.CreateWithExports(MefTestHelpers.CreateExport<ITelemetryLogger>(this.logger = new ConfigurableTelemetryLogger())));

            this.solutionRootFolder = Path.Combine(this.TestContext.TestRunDirectory, this.TestContext.TestName);
            this.dte.Solution = new SolutionMock(dte, Path.Combine(this.solutionRootFolder, "solution.sln"));
        }
        public void TestInitialize()
        {
            this.serviceProvider = new ConfigurableServiceProvider();
            var outputWindow = new ConfigurableVsOutputWindow();
            this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane();
            this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow);

            this.logger = new ConfigurableTelemetryLogger();
            this.serviceProvider.RegisterService(typeof(SComponentModel),
                ConfigurableComponentModel.CreateWithExports(
                    MefTestHelpers.CreateExport<ITelemetryLogger>(this.logger)));
        }
        public void TelemetryLoggerAccessor_GetLogger()
        {
            // Arrange
            var loggerInstance = new ConfigurableTelemetryLogger();
            var componentModel = ConfigurableComponentModel.CreateWithExports(
                MefTestHelpers.CreateExport <ITelemetryLogger>(loggerInstance));

            // Act
            ITelemetryLogger logger = TelemetryLoggerAccessor.GetLogger(componentModel);

            // Assert
            logger.Should().Be(loggerInstance, "Failed to find the MEF service: {0}", nameof(ITelemetryLogger));
        }
Beispiel #4
0
        public void TestInitialize()
        {
            this.serviceProvider = new ConfigurableServiceProvider();
            var outputWindow = new ConfigurableVsOutputWindow();

            this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane();
            this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow);

            this.logger = new ConfigurableTelemetryLogger();
            this.serviceProvider.RegisterService(typeof(SComponentModel),
                                                 ConfigurableComponentModel.CreateWithExports(
                                                     MefTestHelpers.CreateExport <ITelemetryLogger>(this.logger)));
        }
        public void TelemetryLoggerAccessor_GetLogger()
        {
            // Setup
            ConfigurableServiceProvider sp = new ConfigurableServiceProvider();
            var loggerInstance = new ConfigurableTelemetryLogger();
            var componentModel = ConfigurableComponentModel.CreateWithExports(
                MefTestHelpers.CreateExport<ITelemetryLogger>(loggerInstance));
            sp.RegisterService(typeof(SComponentModel), componentModel);

            // Act
            ITelemetryLogger logger = TelemetryLoggerAccessor.GetLogger(sp);

            // Verify
            Assert.AreSame(loggerInstance, logger, "Failed to find the MEF service: {0}", nameof(ITelemetryLogger));
        }
        public void TelemetryLoggerAccessor_GetLogger()
        {
            // Setup
            ConfigurableServiceProvider sp = new ConfigurableServiceProvider();
            var loggerInstance             = new ConfigurableTelemetryLogger();
            var componentModel             = ConfigurableComponentModel.CreateWithExports(
                MefTestHelpers.CreateExport <ITelemetryLogger>(loggerInstance));

            sp.RegisterService(typeof(SComponentModel), componentModel);

            // Act
            ITelemetryLogger logger = TelemetryLoggerAccessor.GetLogger(sp);

            // Verify
            Assert.AreSame(loggerInstance, logger, "Failed to find the MEF service: {0}", nameof(ITelemetryLogger));
        }
Beispiel #7
0
        public void TestInitialize()
        {
            this.monitorSelection = KnownUIContextsAccessor.MonitorSelectionService;

            this.serviceProvider = new ConfigurableServiceProvider();
            this.serviceProvider.RegisterService(typeof(DTE), this.dte = new DTEMock());
            this.serviceProvider.RegisterService(typeof(SComponentModel),
                                                 ConfigurableComponentModel.CreateWithExports(MefTestHelpers.CreateExport <ITelemetryLogger>(this.logger = new ConfigurableTelemetryLogger())));

            this.solutionRootFolder = Path.Combine(this.TestContext.TestRunDirectory, this.TestContext.TestName);
            this.dte.Solution       = new SolutionMock(dte, Path.Combine(this.solutionRootFolder, "solution.sln"));
        }