public void LatestServer_APICompatibility() { // Arrange the service used to interact with SQ var s = new SonarQubeServiceWrapper(this.serviceProvider); var connection = new ConnectionInformation(new Uri("https://sonarqube.com")); // Step 1: Connect anonymously ProjectInformation[] projects = null; RetryAction(() => s.TryGetProjects(connection, CancellationToken.None, out projects), "Get projects from SonarQube server"); projects.Should().NotBeEmpty("No projects were returned"); // Step 2: Get quality profile for the first project var project = projects.FirstOrDefault(); QualityProfile profile = null; RetryAction(() => s.TryGetQualityProfile(connection, project, Language.CSharp, CancellationToken.None, out profile), "Get quality profile from SonarQube server"); profile.Should().NotBeNull("No quality profile was returned"); // Step 3: Get quality profile export for the quality profile RoslynExportProfile export = null; RetryAction(() => s.TryGetExportProfile(connection, profile, Language.CSharp, CancellationToken.None, out export), "Get quality profile export from SonarQube server"); export.Should().NotBeNull("No quality profile export was returned"); // Errors are logged to output window pane and we don't expect any this.outputWindowPane.AssertOutputStrings(0); }
public void LatestServer_APICompatibility() { // Setup the service used to interact with SQ var s = new SonarQubeServiceWrapper(this.serviceProvider); var connection = new ConnectionInformation(new Uri("http://nemo.sonarqube.org")); // Step 1: Connect anonymously ProjectInformation[] projects = null; RetryAction(() => s.TryGetProjects(connection, CancellationToken.None, out projects), "Get projects from SonarQube server"); Assert.AreNotEqual(0, projects.Length, "No projects were returned"); // Step 2: Get quality profile for the first project var project = projects.FirstOrDefault(); QualityProfile profile = null; RetryAction(() => s.TryGetQualityProfile(connection, project, Language.CSharp, CancellationToken.None, out profile), "Get quality profile from SonarQube server"); Assert.IsNotNull(profile, "No quality profile was returned"); // Step 3: Get quality profile export for the quality profile RoslynExportProfile export = null; RetryAction(() => s.TryGetExportProfile(connection, profile, Language.CSharp, CancellationToken.None, out export), "Get quality profile export from SonarQube server"); Assert.IsNotNull(export, "No quality profile export was returned"); // Errors are logged to output window pane and we don't expect any this.outputWindowPane.AssertOutputStrings(0); }
public void SonarQubeServiceWrapper_TryGetQualityProfile_ArgChecks() { // Setup var testSubject = new SonarQubeServiceWrapper(this.serviceProvider); QualityProfile profile; var validConnection = new ConnectionInformation(new Uri("http://valid")); var validProject = new ProjectInformation(); var validLanguage = Language.CSharp; var cppLanguage = new Language("Cpp", "C++", Guid.NewGuid()); // Act + Verify Exceptions.Expect <ArgumentNullException>(() => testSubject.TryGetQualityProfile(null, validProject, validLanguage, CancellationToken.None, out profile)); Exceptions.Expect <ArgumentNullException>(() => testSubject.TryGetQualityProfile(validConnection, null, validLanguage, CancellationToken.None, out profile)); Exceptions.Expect <ArgumentNullException>(() => testSubject.TryGetQualityProfile(validConnection, validProject, null, CancellationToken.None, out profile)); Exceptions.Expect <ArgumentOutOfRangeException>(() => testSubject.TryGetQualityProfile(validConnection, validProject, cppLanguage, CancellationToken.None, out profile)); this.outputWindowPane.AssertOutputStrings(0); }