示例#1
0
        public void EnsureIsConnected_WhenNotConnected_Throws()
        {
            // Arrange
            var client  = new Mock <ISonarQubeClient>();
            var service = new SonarQubeService(WrapInMockFactory(client));

            // Act
            Action action = () => service.EnsureIsConnected();

            // Assert
            action.Should().ThrowExactly <InvalidOperationException>().WithMessage("This operation expects the service to be connected.");
        }
示例#2
0
        public async Task EnsureIsConnected_WhenConnected_ShouldDoNothing()
        {
            // Arrange
            var client  = GetMockSqClientWithCredentialAndVersion("1.0.0.0");
            var service = new SonarQubeService(WrapInMockFactory(client));

            await service.ConnectAsync(new ConnectionInformation(new Uri("http://mysq.com")), CancellationToken.None);

            // Act
            Action action = () => service.EnsureIsConnected();

            // Assert
            client.VerifyAll();
            action.Should().NotThrow <InvalidOperationException>();
        }