Example #1
0
        public void IsBindingRequired_ProjectHasTwoLanguages_ReturnsIfAllLanguagesHaveConfigFiles(bool isFirstLanguageBound, bool isSecondLanguageBound, bool expectedResult)
        {
            var projectMock = new ProjectMock("c:\\test.csproj");

            projectMock.SetProjectKind(new Guid(ProjectSystemHelper.CppProjectKind));

            var bindingConfiguration = new BindingConfiguration(new BoundSonarQubeProject(new Uri("http://test.com"), "key", "name"),
                                                                SonarLintMode.Connected, "c:\\");

            var cppFilePath = bindingConfiguration.BuildPathUnderConfigDirectory(Language.Cpp.FileSuffixAndExtension);
            var cFilePath   = bindingConfiguration.BuildPathUnderConfigDirectory(Language.C.FileSuffixAndExtension);

            fileSystemMock
            .Setup(x => x.File.Exists(cppFilePath))
            .Returns(isFirstLanguageBound);

            if (isFirstLanguageBound)
            {
                fileSystemMock
                .Setup(x => x.File.Exists(cFilePath))
                .Returns(isSecondLanguageBound);
            }

            var result = testSubject.IsBindingRequired(bindingConfiguration, projectMock);

            result.Should().Be(expectedResult);

            fileSystemMock.VerifyAll();
        }
Example #2
0
        public void IsBindingRequired_ProjectLanguageIsNotSupported_False()
        {
            var projectMock = new ProjectMock("c:\\test.csproj");

            projectMock.SetProjectKind(new Guid(ProjectSystemHelper.CppProjectKind));

            var bindingConfiguration = new BindingConfiguration(new BoundSonarQubeProject(new Uri("http://test.com"), "key", "name"),
                                                                SonarLintMode.Connected, "c:\\");

            var result = testSubject.IsBindingRequired(bindingConfiguration, projectMock);

            result.Should().Be(false);

            VerifySolutionAdditionalFileNotChecked(bindingConfiguration);
            VerifySolutionRulesetNotChecked(bindingConfiguration);
            VerifyProjectAdditionalFileNotChecked();
            VerifyProjectRulesetsNotChecked();
        }