Esempio n. 1
0
 protected override void Given()
 {
     this.testResponse    = new TestResponse();
     this.pipelineContext = new PipelineContext(new TestRequest(), this.testResponse);
     this.subject         = new JsonResultExecutor(new NoopTempDataMechanism());
     this.result          = new JsonResult(new { foo = "bar" });
 }
Esempio n. 2
0
 protected override void Given()
 {
     this.testResponse    = new TestResponse();
     this.pipelineContext = new PipelineContext(new TestRequest(), this.testResponse);
     this.subject         = new JsonResultExecutor(new NoopTempDataMechanism());
     this.json            = "{ \"json\": \"i am\" }";
     this.result          = new JsonResult(this.json);
 }
Esempio n. 3
0
        private static HttpContext GetHttpContext()
        {
            var httpContext = new DefaultHttpContext();

            httpContext.Response.Body = new MemoryStream();

            var executor = new JsonResultExecutor(
                new TestHttpResponseStreamWriterFactory(),
                NullLogger <JsonResultExecutor> .Instance,
                new TestOptionsManager <MvcJsonOptions>());

            var services = new ServiceCollection();

            services.AddSingleton(executor);
            httpContext.RequestServices = services.BuildServiceProvider();

            return(httpContext);
        }