public void EncodeAsSonarQubeMultiValueProperty_WhenSQGreaterThanOrEqualTo65_EscapeAndJoinPaths() { // Arrange var config65 = new AnalysisConfig { SonarOutputDir = @"C:\my_folder", SonarQubeVersion = "6.5" }; var config66 = new AnalysisConfig { SonarOutputDir = @"C:\my_folder", SonarQubeVersion = "6.6" }; var testSubject65 = new PropertiesWriter(config65, new TestLogger()); var testSubject66 = new PropertiesWriter(config66, new TestLogger()); var paths = new[] { "C:\\foo.cs", "C:\\foo,bar.cs", "C:\\foo\"bar.cs" }; // Act var actual65 = testSubject65.EncodeAsSonarQubeMultiValueProperty(paths); var actual66 = testSubject66.EncodeAsSonarQubeMultiValueProperty(paths); // Assert actual65.Should().Be(@"""C:\foo.cs"",\ ""C:\foo,bar.cs"",\ ""C:\foo""""bar.cs"""); actual66.Should().Be(actual65); }
private void EncodeAsSonarQubeMultiValueProperty_WhenGivenSQVersionAndNoInvalidPath_JoinPaths(string sonarqubeVersion) { // Arrange var config = new AnalysisConfig { SonarOutputDir = @"C:\my_folder", SonarQubeVersion = sonarqubeVersion }; var testSubject = new PropertiesWriter(config, new TestLogger()); var paths = new[] { "C:\\foo.cs", "C:\\foobar.cs" }; // Act var actual = testSubject.EncodeAsSonarQubeMultiValueProperty(paths); // Assert actual.Should().Be(@"C:\foo.cs,\ C:\foobar.cs"); }
private void EncodeAsSonarQubeMultiValueProperty_WhenGivenSQVersionAndInvalidPath_ExcludeInvalidPathAndJoinOthers(string sonarqubeVersion) { // Arrange var config = new AnalysisConfig { SonarOutputDir = @"C:\my_folder", SonarQubeVersion = sonarqubeVersion }; var logger = new TestLogger(); var testSubject = new PropertiesWriter(config, logger); var paths = new[] { "C:\\foo.cs", "C:\\foo,bar.cs" }; // Act var actual = testSubject.EncodeAsSonarQubeMultiValueProperty(paths); // Assert actual.Should().Be(@"C:\foo.cs"); logger.Warnings.Should().HaveCount(1); logger.Warnings[0].Should().Be("The following paths contain invalid characters for this version of SonarQube and will be excluded from this analysis: C:\\foo,bar.cs"); }