Example #1
0
        public Scenario(IScenarioSupport support)
        {
            _support = support;
            _request = OwinHttpRequest.ForTesting();
            _request.FullUrl(support.RootUrl);
            _request.Environment.Add("scenario-support", _support);
            _request.Accepts("*/*");

            support.Get <SecuritySettings>().Reset();

            _response = new Lazy <OwinHttpResponse>(() =>
            {
                var response = _support.Send(_request);

                if (!_ignoreStatusCode)
                {
                    validateStatusCode(response);
                }


                return(response);
            });

            _bodyText = new Lazy <string>(() => _response.Value.Body.ReadAsText());
        }
Example #2
0
        SendExpression IUrlExpression.Json <T>(T input)
        {
            this.As <IUrlExpression>().Input(input);
            _request.Body.JsonInputIs(_support.Get <IJsonSerializer>().Serialize(input));

            _request.ContentType("application/json");
            _request.Accepts("application/json");

            return(new SendExpression(_request));
        }