public static TestAppHost CreateAppHost() { var appHost = new TestAppHost(); appHost.Init(); return(appHost); }
public void Can_run_nested_service() { var host = new TestAppHost(); host.Init(); var request = new Nested(); var response = host.ExecuteService(request) as NestedResponse; Assert.That(response, Is.Not.Null); }
public void Can_run_test_service() { var host = new TestAppHost(); host.Init(); var request = new Test(); var response = host.ExecuteService(request) as TestResponse; Assert.That(response, Is.Not.Null); Assert.That(response.Foo, Is.Not.Null); }
public ServiceStackHostFixture() { var appHost = new TestAppHost(); appHost.Init(); if (!appHost.HasStarted) { appHost.Start(ListeningOn); } AppHost = appHost; }
public void Call_AsyncOneWay_endpoint_on_AsyncTestService_calls_ExecuteAsync() { var host = new TestAppHost(); host.Init(); TestAsyncService.ResetStats(); var request = new TestAsync(); var response = host.ExecuteService(request, EndpointAttributes.OneWay) as TestAsyncResponse; Assert.That(response, Is.Not.Null); Assert.That(response.ExecuteTimes, Is.EqualTo(0)); Assert.That(response.ExecuteAsyncTimes, Is.EqualTo(1)); }
public void Can_treat_warnings_and_info_as_errors() { using (var appHost = new TestAppHost()) { appHost.Plugins.Add(new ValidationFeature { TreatInfoAndWarningsAsErrors = true }); appHost.Init(); appHost.Start(Urlbase); var sc = new JsonServiceClient(Urlbase); Assert.Throws <WebServiceException>(() => sc.Get(new EchoRequest { Day = "Monday", Word = "" }), "'Word' should not be empty."); } }
public void Response_returned_when_valid() { using (var appHost = new TestAppHost()) { appHost.Plugins.Add(new ValidationFeature()); appHost.Init(); appHost.Start(Urlbase); var sc = new JsonServiceClient(Urlbase); var response = sc.Get(new EchoRequest { Day = "Monday", Word = "Word" }); Assert.That(response.Day, Is.EqualTo("Monday")); Assert.That(response.Word, Is.EqualTo("Word")); } }
public void Can_return_response_when_no_failed_validations_and_TreatInfoAndWarningsAsErrors_set_false() { using (var appHost = new TestAppHost()) { appHost.Plugins.Add(new ValidationFeature { TreatInfoAndWarningsAsErrors = false }); appHost.Init(); appHost.Start(Urlbase); var sc = new JsonServiceClient(Urlbase); var resp = sc.Get(new EchoRequest { Day = "Monday", Word = "Word" }); Assert.That(resp.ResponseStatus, Is.Null); } }
public void Can_ignore_warnings_and_info_as_errors() { using (var appHost = new TestAppHost()) { appHost.Plugins.Add(new ValidationFeature { TreatInfoAndWarningsAsErrors = false }); appHost.Init(); appHost.Start(Urlbase); var sc = new JsonServiceClient(Urlbase); var response = sc.Get(new EchoRequest { Day = "", Word = "" }); Assert.That(response.ResponseStatus, Is.Not.Null); Assert.That(response.ResponseStatus.Errors, Is.Not.Empty); Assert.That(response.ResponseStatus.Errors.First().Meta["Severity"], Is.EqualTo("Info")); Assert.That(response.ResponseStatus.Errors[1].Meta["Severity"], Is.EqualTo("Warning")); } }
public void RunBeforeAnyTests() { _appHost = new TestAppHost(); _appHost.Init(); _appHost.Start(Config.ServiceStackBaseUri); }
public void RunBeforeAnyTests() { _appHost = new TestAppHost(); _appHost.Init(); _appHost.Start(Config.ServiceStackBaseUri); }