public ServiceStackHostFixture()
        {
            var appHost = new TestAppHost();

            appHost.Init();

            if (!appHost.HasStarted)
            {
                appHost.Start(ListeningOn);
            }

            AppHost = appHost;
        }
            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);
 }