static int Main(string[] args) { if (AppDomain.CurrentDomain.IsDefaultAppDomain()) { return(CreateNewAppDomain()); } var options = new OptionSet(); options.Add("p|port=", (int v) => DefaultPort = v); options.Add("h|?|help", v => ShowHelp(options)); options.Parse(Environment.GetCommandLineArgs()); var uri = new Uri($"http://localhost:{DefaultPort}"); using (var host = new ServiceStubsHost(uri)) { host.Start(); Console.WriteLine($"Listening for requests at {uri.OriginalString}"); Console.WriteLine("Hit ENTER to quit..."); Console.WriteLine(""); Console.ReadLine(); } return(0); }
public void given_resource_is_not_found_when_getting_should_throw() { using (var host = new ServiceStubsHost(new Uri("http://localhost:5000/"))) { host.Start(); var gateway = new SystemGateway(new Uri("http://localhost:5000/notfound/")); Action action = () => gateway.Get(); action .ShouldThrow <ApplicationException>() .WithMessage(SystemGateway.NotFoundErrort); } }
public void given_service_is_up_when_getting_should_return_system_info() { var baseUri = new Uri("http://localhost:5000/"); using (var host = new ServiceStubsHost(baseUri)) { host.Start(); var gateway = new SystemGateway(baseUri); var info = gateway.Get(); var expectedMachineName = Environment.MachineName; var expectedDateTime = new DateTimeOffset(2012, 01, 01, 11, 24, 15, TimeSpan.FromHours(-5)); info.ServerName.Should().Be(expectedMachineName); info.ServerTimeStamp.Should().Be(expectedDateTime); } }
public void SetUp() { _host = new ServiceStubsHost("http://localhost:1234"); StaticConfiguration.DisableErrorTraces = false; _host.Start(); }