public static JsonpResult Jsonp(this Controller controller, object data) { JsonpResult result = new JsonpResult(); result.Data = data; result.ExecuteResult(controller.ControllerContext); return result; }
public static JsonpResult Jsonp(this Controller controller, object data) { JsonpResult result = new JsonpResult(); result.Data = data; result.ExecuteResult(controller.ControllerContext); return(result); }
private static Mock<HttpResponseBase> ExecuteAndGetResponse(JsonpResult result) { var fakeControllerContext = new Mock<ControllerContext>(); var fakeHttpContext = new Mock<HttpContextBase>(); var fakeHttpRequest = new Mock<HttpRequestBase>(); var fakeHttpResponse = new Mock<HttpResponseBase>(); fakeHttpRequest.SetupGet(request => request.QueryString).Returns(new NameValueCollection { { "Callback ", "fakeCallback" } }); fakeHttpContext.Setup(c => c.Request).Returns(fakeHttpRequest.Object); fakeHttpContext.Setup(c => c.Response).Returns(fakeHttpResponse.Object); fakeControllerContext.Setup(c => c.HttpContext).Returns(fakeHttpContext.Object); result.ExecuteResult(fakeControllerContext.Object); return fakeHttpResponse; }