Ejemplo n.º 1
0
        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()));
        }
Ejemplo n.º 2
0
        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();
        }