public void VsSessionHost_ArgChecks() { var loggerMock = new Mock <ILogger>(); Action action = () => new VsSessionHost(this.serviceProvider, null, new ConfigurableActiveSolutionTracker(), loggerMock.Object); action.Should().ThrowExactly <ArgumentNullException>(); action = () => new VsSessionHost(null, sonarQubeServiceMock.Object, new ConfigurableActiveSolutionTracker(), loggerMock.Object); action.Should().ThrowExactly <ArgumentNullException>(); action = () => new VsSessionHost(this.serviceProvider, sonarQubeServiceMock.Object, null, loggerMock.Object); action.Should().ThrowExactly <ArgumentNullException>(); action = () => new VsSessionHost(this.serviceProvider, sonarQubeServiceMock.Object, new ConfigurableActiveSolutionTracker(), null); action.Should().ThrowExactly <ArgumentNullException>(); action = () => new VsSessionHost(this.serviceProvider, null, null, sonarQubeServiceMock.Object, new ConfigurableActiveSolutionTracker(), loggerMock.Object, null); action.Should().ThrowExactly <ArgumentNullException>(); using (var host = new VsSessionHost(this.serviceProvider, sonarQubeServiceMock.Object, new ConfigurableActiveSolutionTracker(), loggerMock.Object)) { host.Should().NotBeNull("Not expecting this to fail, just to make the static analyzer happy"); } }
public void VsSessionHost_ArgChecks() { Exceptions.Expect <ArgumentNullException>(() => new VsSessionHost(null, new Integration.Service.SonarQubeServiceWrapper(this.serviceProvider), new ConfigurableActiveSolutionTracker())); Exceptions.Expect <ArgumentNullException>(() => new VsSessionHost(this.serviceProvider, null, new ConfigurableActiveSolutionTracker())); Exceptions.Expect <ArgumentNullException>(() => new VsSessionHost(this.serviceProvider, new Integration.Service.SonarQubeServiceWrapper(this.serviceProvider), null)); Exceptions.Expect <ArgumentNullException>(() => new VsSessionHost(this.serviceProvider, null, null, new Integration.Service.SonarQubeServiceWrapper(this.serviceProvider), new ConfigurableActiveSolutionTracker(), null)); using (var host = new VsSessionHost(this.serviceProvider, new Integration.Service.SonarQubeServiceWrapper(this.serviceProvider), new ConfigurableActiveSolutionTracker())) { host.Should().NotBeNull("Not expecting this to fail, just to make the static analyzer happy"); } }