Example #1
0
        public void TestInitialize()
        {
            KnownUIContextsAccessor.Reset();
            this.sonarQubeService = new Mock <ISonarQubeService>();
            this.workflow         = new TestBindingWorkflow();
            this.serviceProvider  = new ConfigurableServiceProvider();
            this.dteMock          = new DTEMock();
            this.serviceProvider.RegisterService(typeof(DTE), this.dteMock);
            this.solutionMock        = new SolutionMock();
            this.monitorSelection    = KnownUIContextsAccessor.MonitorSelectionService;
            this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.conflictsController = new ConfigurableRuleSetConflictsController();
            this.configProvider      = new ConfigurableConfigurationProvider();
            this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper);
            this.serviceProvider.RegisterService(typeof(IRuleSetConflictsController), this.conflictsController);
            this.serviceProvider.RegisterService(typeof(IConfigurationProvider), this.configProvider);

            var outputWindow = new ConfigurableVsOutputWindow();

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

            this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            this.host.SonarQubeService = sonarQubeService.Object;

            // Instead of ignored unexpected service, register one (for telemetry)
            this.serviceProvider.RegisterService(typeof(SComponentModel), new ConfigurableComponentModel());
        }
Example #2
0
        public void TestInitialize()
        {
            KnownUIContextsAccessor.Reset();
            this.sonarQubeService = new Mock <ISonarQubeService>();
            this.workflow         = new TestBindingWorkflow();
            this.serviceProvider  = new ConfigurableServiceProvider();
            this.dteMock          = new DTEMock();
            this.serviceProvider.RegisterService(typeof(DTE), this.dteMock);
            this.solutionMock                = new SolutionMock();
            this.monitorSelection            = KnownUIContextsAccessor.MonitorSelectionService;
            this.projectSystemHelper         = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.conflictsController         = new ConfigurableRuleSetConflictsController();
            this.configProvider              = new ConfigurableConfigurationProvider();
            this.ruleSetsInformationProvider = new ConfigurableSolutionRuleSetsInformationProvider();
            this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper);
            this.serviceProvider.RegisterService(typeof(IRuleSetConflictsController), this.conflictsController);
            this.serviceProvider.RegisterService(typeof(IConfigurationProviderService), this.configProvider);
            this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetsInformationProvider);
            this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), new ConfigurableSourceControlledFileSystem(new MockFileSystem()));

            var outputWindow = new ConfigurableVsOutputWindow();

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

            this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher)
            {
                SonarQubeService = sonarQubeService.Object
            };

            configProvider.FolderPathToReturn = "c:\\test";
        }
Example #3
0
        public void TestInitialize()
        {
            KnownUIContextsAccessor.Reset();
            this.sonarQubeService = new Mock <ISonarQubeService>();
            this.workflow         = new TestBindingWorkflow();
            this.serviceProvider  = new ConfigurableServiceProvider();
            this.dteMock          = new DTEMock();
            this.serviceProvider.RegisterService(typeof(DTE), this.dteMock);
            this.solutionMock        = new SolutionMock();
            this.monitorSelection    = KnownUIContextsAccessor.MonitorSelectionService;
            this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.conflictsController = new ConfigurableRuleSetConflictsController();
            this.configProvider      = new ConfigurableConfigurationProvider();
            this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper);
            this.serviceProvider.RegisterService(typeof(IRuleSetConflictsController), this.conflictsController);
            this.serviceProvider.RegisterService(typeof(IConfigurationProvider), this.configProvider);

            var outputWindow = new ConfigurableVsOutputWindow();

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

            this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            this.host.SonarQubeService = sonarQubeService.Object;

            IComponentModel componentModel = ConfigurableComponentModel.CreateWithExports(
                new []
            {
                MefTestHelpers.CreateExport <ITelemetryLogger>(new ConfigurableTelemetryLogger())
            });

            this.serviceProvider.RegisterService(typeof(SComponentModel), componentModel);
        }
Example #4
0
        public void TestInitialize()
        {
            this.dte             = new DTEMock();
            this.serviceProvider = new ConfigurableServiceProvider();
            this.solutionMock    = new SolutionMock(dte, Path.Combine(SolutionRoot, "xxx.sln"));
            this.outputPane      = new ConfigurableVsOutputWindowPane();
            this.serviceProvider.RegisterService(typeof(SVsGeneralOutputWindowPane), this.outputPane);
            this.projectSystemHelper  = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.solutionItemsProject = this.solutionMock.AddOrGetProject("Solution items");
            this.projectSystemHelper.SolutionItemsProject  = this.solutionItemsProject;
            this.projectSystemHelper.CurrentActiveSolution = this.solutionMock;
            this.fileSystem    = new MockFileSystem();
            this.sccFileSystem = new ConfigurableSourceControlledFileSystem(fileSystem);
            this.ruleFS        = new ConfigurableRuleSetSerializer(fileSystem);
            this.ruleSetInfo   = new ConfigurableSolutionRuleSetsInformationProvider
            {
                SolutionRootFolder = SolutionRoot
            };

            this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper);
            this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), this.sccFileSystem);
            this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), this.ruleFS);
            this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfo);

            projectBinderFactoryMock = new Mock <IProjectBinderFactory>();
        }
        public void TestInitialize()
        {
            fileSystem = new MockFileSystem();

            this.dte             = new DTEMock();
            this.serviceProvider = new ConfigurableServiceProvider();
            this.solutionMock    = new SolutionMock(dte, Path.Combine(SolutionRoot, "xxx.sln"));
            this.projectMock     = this.solutionMock.AddOrGetProject(Path.Combine(SolutionRoot, @"Project\project.proj"));
            this.outputPane      = new ConfigurableVsOutputWindowPane();
            this.serviceProvider.RegisterService(typeof(SVsGeneralOutputWindowPane), this.outputPane);
            this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.sccFileSystem       = new ConfigurableSourceControlledFileSystem(fileSystem);
            this.ruleSetFS           = new ConfigurableRuleSetSerializer(fileSystem);
            this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), this.sccFileSystem);
            this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), this.ruleSetFS);
            this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider),
                                                 new SolutionRuleSetsInformationProvider(this.serviceProvider, new Mock <ILogger>().Object, new MockFileSystem()));
            this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper);

            var coreRuleSet    = new FilePathAndContent <CoreRuleSet>(@"c:\Solution\sln.ruleset", new CoreRuleSet());
            var vsRuleSet      = new VsRuleSet("VS ruleset");
            var additionalFile = new FilePathAndContent <SonarLintConfiguration>(@"c:\Solution\additionalFile.txt", new SonarLintConfiguration());

            cSharpVBBindingConfig = new CSharpVBBindingConfig(coreRuleSet, additionalFile);

            ruleSetFS.RegisterRuleSet(vsRuleSet, coreRuleSet.Path);

            additionalFileConflictChecker = new Mock <IAdditionalFileConflictChecker>();
            ruleSetReferenceChecker       = new Mock <IRuleSetReferenceChecker>();
        }
        public void TestInit()
        {
            this.serviceProvider = new ConfigurableServiceProvider();

            this.dte = new DTEMock();
            this.serviceProvider.RegisterService(typeof(EnvDTE.DTE), this.dte);

            var outputWindow = new ConfigurableVsOutputWindow();
            this.outputPane = outputWindow.GetOrCreateSonarLintPane();
            this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow);

            this.testSubject = new TelemetryLogger(this.serviceProvider);
        }
Example #7
0
        public void TestInit()
        {
            this.serviceProvider = new ConfigurableServiceProvider();

            this.dte = new DTEMock();
            this.serviceProvider.RegisterService(typeof(EnvDTE.DTE), this.dte);

            var outputWindow = new ConfigurableVsOutputWindow();

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

            this.testSubject = new TelemetryLogger(this.serviceProvider);
        }
        public void TestInitialize()
        {
            this.dte = new DTEMock();
            this.serviceProvider = new ConfigurableServiceProvider();
            this.solutionMock = new SolutionMock(dte, Path.Combine(SolutionRoot, "xxx.sln"));
            this.projectMock = this.solutionMock.AddOrGetProject(Path.Combine(SolutionRoot, @"Project\project.proj"));
            this.outputPane = new ConfigurableVsOutputWindowPane();
            this.serviceProvider.RegisterService(typeof(SVsGeneralOutputWindowPane), this.outputPane);
            this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.ruleStore = new ConfigurableSolutionRuleStore();
            this.sccFileSystem = new ConfigurableSourceControlledFileSystem();
            this.ruleSetFS = new ConfigurableRuleSetSerializer(this.sccFileSystem);

            this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), this.sccFileSystem);
            this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), this.ruleSetFS);
            this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), new SolutionRuleSetsInformationProvider(this.serviceProvider));
        }
Example #9
0
        public void TestInitialize()
        {
            this.dte             = new DTEMock();
            this.serviceProvider = new ConfigurableServiceProvider();
            this.solutionMock    = new SolutionMock(dte, Path.Combine(SolutionRoot, "xxx.sln"));
            this.projectMock     = this.solutionMock.AddOrGetProject(Path.Combine(SolutionRoot, @"Project\project.proj"));
            this.outputPane      = new ConfigurableVsOutputWindowPane();
            this.serviceProvider.RegisterService(typeof(SVsGeneralOutputWindowPane), this.outputPane);
            this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.ruleStore           = new ConfigurableSolutionRuleStore();
            this.sccFileSystem       = new ConfigurableSourceControlledFileSystem();
            this.ruleSetFS           = new ConfigurableRuleSetSerializer(this.sccFileSystem);

            this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), this.sccFileSystem);
            this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), this.ruleSetFS);
            this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), new SolutionRuleSetsInformationProvider(this.serviceProvider));
        }
        public void TestInitialize()
        {
            KnownUIContextsAccessor.Reset();
            this.sonarQubeService = new ConfigurableSonarQubeServiceWrapper();
            this.workflow = new TestBindingWorkflow();
            this.serviceProvider = new ConfigurableServiceProvider();
            this.dteMock = new DTEMock();
            this.serviceProvider.RegisterService(typeof(DTE), this.dteMock);
            this.solutionMock = new SolutionMock();
            this.monitorSelection = KnownUIContextsAccessor.MonitorSelectionService;
            this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.conflictsController = new ConfigurableRuleSetConflictsController();
            this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper);
            this.serviceProvider.RegisterService(typeof(IRuleSetConflictsController), this.conflictsController);

            this.host = new ConfigurableHost(this.serviceProvider, Dispatcher.CurrentDispatcher);
            this.host.SonarQubeService = sonarQubeService;

            // Instead of ignored unexpected service, register one (for telemetry)
            this.serviceProvider.RegisterService(typeof(SComponentModel), new ConfigurableComponentModel());
        }
        public void TestInitialize()
        {
            this.dte = new DTEMock();
            this.serviceProvider = new ConfigurableServiceProvider();
            this.solutionMock = new SolutionMock(dte, Path.Combine(SolutionRoot, "xxx.sln"));
            this.outputPane = new ConfigurableVsOutputWindowPane();
            this.serviceProvider.RegisterService(typeof(SVsGeneralOutputWindowPane), this.outputPane);
            this.projectSystemHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider);
            this.projectFilter = new ConfigurableProjectSystemFilter();
            this.solutionItemsProject = this.solutionMock.AddOrGetProject("Solution items");
            this.projectSystemHelper.SolutionItemsProject = this.solutionItemsProject;
            this.projectSystemHelper.CurrentActiveSolution = this.solutionMock;
            this.sccFileSystem  = new ConfigurableSourceControlledFileSystem();
            this.ruleFS = new ConfigurableRuleSetSerializer(this.sccFileSystem);
            this.solutionBinding = new ConfigurableSolutionBindingSerializer();
            this.ruleSetInfo = new ConfigurableSolutionRuleSetsInformationProvider();
            this.ruleSetInfo.SolutionRootFolder = SolutionRoot;

            this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectSystemHelper);
            this.serviceProvider.RegisterService(typeof(ISourceControlledFileSystem), this.sccFileSystem);
            this.serviceProvider.RegisterService(typeof(IRuleSetSerializer), this.ruleFS);
            this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfo);
        }