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" }); }
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); }
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); }