public ICredentials Load(Uri boundServerUri) { if (boundServerUri == null) { return(null); } var credentials = store.ReadCredentials(boundServerUri); return(credentials == null ? null : new BasicAuthCredentials(credentials.Username, credentials.Password.ToSecureString())); }
public void WriteSolution_NoCredentials_FileSavedOk() { // Arrange SetSolutionFilePath(@"c:\mysolutionfile.foo"); var expectedFilePath = @"c:\.sonarlint\mysolutionfile.slconfig"; var boundProject = new BoundSonarQubeProject { ProjectKey = "mykey", ServerUri = new Uri("http://localhost:9000"), }; // Act var actualFilePath = testSubject.WriteSolutionBinding(boundProject); // queue the changes configurableSccFileSystem.WritePendingNoErrorsExpected(); // write the queued changes // Assert actualFilePath.Should().Be(expectedFilePath); fileMock.Verify(x => x.WriteAllText(expectedFilePath, It.IsAny <string>()), Times.Once); var savedCredentials = configurableStore.ReadCredentials(new Uri("http://localhost:9000")); savedCredentials.Should().BeNull(); }