public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.projectHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectHelper); this.ruleSetInfoProvider = new ConfigurableSolutionRuleSetsInformationProvider(); this.ruleSetInfoProvider.SolutionRootFolder = this.TestContext.TestRunDirectory; this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfoProvider); this.fileSystem = new ConfigurableFileSystem(); this.serviceProvider.RegisterService(typeof(IFileSystem), this.fileSystem); this.solutionBinding = new ConfigurableSolutionBindingSerializer(); this.serviceProvider.RegisterService(typeof(ISolutionBindingSerializer), this.solutionBinding); this.inspector = new ConfigurableRuleSetInspector(); this.serviceProvider.RegisterService(typeof(IRuleSetInspector), this.inspector); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.dte = new DTEMock(); this.projectHelper.CurrentActiveSolution = new SolutionMock(dte); }
public void TestInit() { this.serviceProvider = new ConfigurableServiceProvider(); this.projectHelper = new ConfigurableVsProjectSystemHelper(this.serviceProvider); this.serviceProvider.RegisterService(typeof(IProjectSystemHelper), this.projectHelper); this.ruleSetInfoProvider = new ConfigurableSolutionRuleSetsInformationProvider(); this.ruleSetInfoProvider.SolutionRootFolder = this.TestContext.TestRunDirectory; this.serviceProvider.RegisterService(typeof(ISolutionRuleSetsInformationProvider), this.ruleSetInfoProvider); this.fileSystem = new ConfigurableFileSystem(); this.serviceProvider.RegisterService(typeof(IFileSystem), this.fileSystem); this.configProvider = new ConfigurableConfigurationProvider(); this.serviceProvider.RegisterService(typeof(IConfigurationProvider), this.configProvider); this.inspector = new ConfigurableRuleSetInspector(); this.serviceProvider.RegisterService(typeof(IRuleSetInspector), this.inspector); var outputWindow = new ConfigurableVsOutputWindow(); this.outputWindowPane = outputWindow.GetOrCreateSonarLintPane(); this.serviceProvider.RegisterService(typeof(SVsOutputWindow), outputWindow); this.dte = new DTEMock(); this.projectHelper.CurrentActiveSolution = new SolutionMock(dte); this.testSubject = new ConflictsManager(serviceProvider, new SonarLintOutputLogger(serviceProvider)); }
public void TestInitialize() { KnownUIContextsAccessor.Reset(); this.serviceProvider = new ConfigurableServiceProvider(); this.queryEditAndSave = new ConfigurableVsQueryEditQuerySave2(); this.serviceProvider.RegisterService(typeof(SVsQueryEditQuerySave), this.queryEditAndSave); this.fileSystem = new ConfigurableFileSystem(); }
public void TestInit() { this.temporaryFiles = new TempFileCollection(this.TestContext.TestRunDirectory, keepFiles: false); this.serviceProvider = new ConfigurableServiceProvider(); this.fileSystem = new ConfigurableFileSystem(); this.serviceProvider.RegisterService(typeof(IFileSystem), this.fileSystem); this.testSubject = new RuleSetSerializer(this.serviceProvider); }
public void SolutionRuleSetsInformationProvider_TryGetProjectRuleSetFilePath() { // Setup var testSubject = new SolutionRuleSetsInformationProvider(this.serviceProvider); var fileSystem = new ConfigurableFileSystem(); this.serviceProvider.RegisterService(typeof(IFileSystem), fileSystem); ProjectMock project = new ProjectMock(@"c:\Solution\Project\Project1.myProj"); RuleSetDeclaration declaration; string ruleSetPath; // Case 1: Declaration has an full path which exists on disk declaration = CreateDeclaration(project, @"c:\RuleSet.ruleset"); fileSystem.RegisterFile(declaration.RuleSetPath); // Act Assert.IsTrue(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath)); // Verify Assert.AreEqual(@"c:\RuleSet.ruleset", ruleSetPath); // Case 2: Declaration is relative to project and on disk fileSystem.ClearFiles(); declaration = CreateDeclaration(project, @"..\RuleSet.ruleset"); fileSystem.RegisterFile(@"c:\Solution\RuleSet.ruleset"); // Act Assert.IsTrue(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath)); // Verify Assert.AreEqual(@"c:\Solution\RuleSet.ruleset", ruleSetPath); // Case 3: File doesn't exist fileSystem.ClearFiles(); declaration = CreateDeclaration(project, "MyFile.ruleset"); // Act Assert.IsFalse(testSubject.TryGetProjectRuleSetFilePath(project, declaration, out ruleSetPath)); // Verify Assert.IsNull(ruleSetPath); }
public ConfigurableRuleSetSerializer(ConfigurableFileSystem fs) { this.fileSystem = fs; }