private void GivenAStartedBackChannelHost(ForkedExecutionConfiguration config) { config.BackendAddress = string.Empty; var backChannelHost = new BackChannelWebHost(new JobbrServiceProviderMock(this.jobRunInformationService, this.storedProgressUpdates), config); backChannelHost.Start(); }
private void GivenARunningServer() { var config = new ForkedExecutionConfiguration() { BackendAddress = this.configBackendAddress }; var webHost = new BackChannelWebHost(new JobbrServiceProviderMock(new JobRunInfoServiceMock(this.fakeStore), this.channelFakeStore), config); webHost.Start(); }
public void BackChannel_StartedTwice_RaisesException() { var forkedExecutionConfiguration = new ForkedExecutionConfiguration { BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort() }; var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration); host.Start(); host.Start(); }
public void BackChannel_StartWebHost_StatusUrlIsAvailable() { var forkedExecutionConfiguration = new ForkedExecutionConfiguration { BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort() }; var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration); host.Start(); var response = new HttpClient().GetAsync(forkedExecutionConfiguration.BackendAddress + "/fex/status").Result; Assert.IsTrue(response.IsSuccessStatusCode); }
public void BackChannel_PortInUse_RaisesException() { var nextFreeTcpPort = TcpPortHelper.NextFreeTcpPort(); // intentionally block port new TcpListener(IPAddress.Any, nextFreeTcpPort).Start(); var forkedExecutionConfiguration = new ForkedExecutionConfiguration { BackendAddress = "http://localhost:" + nextFreeTcpPort }; var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration); host.Start(); }
public async Task BackChannel_AfterDisposal_IsNotAvailable() { var forkedExecutionConfiguration = new ForkedExecutionConfiguration { BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort() }; var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration); host.Start(); host.Dispose(); try { await new HttpClient().GetAsync(forkedExecutionConfiguration.BackendAddress + "/fex/status"); } catch (Exception ex) { if (ex.InnerException is WebException == false) { Assert.Fail("Exception thrown was " + ex.InnerException + ", which is not the expected exception"); } } }