SonarLint.VisualStudio.Integration.UnitTests.ConfigurableSourceControlledFileSystem.WritePendingErrorsExpected C# (CSharp) Method

WritePendingErrorsExpected() public method

public WritePendingErrorsExpected ( ) : void
return void
        public void WritePendingErrorsExpected()
        {
            Assert.IsFalse(((ISourceControlledFileSystem)this).WriteQueuedFiles(), "Expected to fail writing the pending files");
        }

Usage Example

        public void WriteSolution_WriteOpFails_CredentialsNotSaved()
        {
            // Arrange
            SetSolutionFilePath(@"c:\my solution file.foo");
            var expectedFilePath = @"c:\.sonarlint\my solution file.slconfig";

            fileMock.Setup(x => x.WriteAllText(It.IsAny <string>(), It.IsAny <string>())).Throws <System.IO.IOException>();

            var boundProject = new BoundSonarQubeProject
            {
                ProjectKey = "mykey",
                ServerUri  = new Uri("http://localhost:9000"),
            };

            // Act
            var actualFilePath = testSubject.WriteSolutionBinding(boundProject); // queue the changes

            configurableSccFileSystem.WritePendingErrorsExpected();              // write the queued changes

            // Assert
            actualFilePath.Should().Be(expectedFilePath);
            var savedCredentials = configurableStore.ReadCredentials(new Uri("http://localhost:9000"));

            savedCredentials.Should().BeNull();
        }