public void PrintActionResultNeedsToCreateAValidJpeg() { //Arrange var memoryStream = new MemoryStream(); var httpContext = new FakeHttpContext(outputStream: memoryStream); var httpController = new Mock <Controller>(); var controllerContext = httpController .Object .SetFakeControllerContext(httpContext.Object, routeValues: new Dictionary <string, string> { { "action", "testaction" }, { "controller", "testcontroller" } }); var mockActionResult = PrintResult.PrintToJpeg(); mockActionResult.RetrieveHtml = (viewName, masterName, model, context) => "<html><head></head><body>Test Content</body></html>"; //Act mockActionResult.ExecuteResult(controllerContext); //Assert var actualBytes = memoryStream.ToArray(); for (var i = 0; i < actualBytes.Length; i++) { Assert.AreEqual(Resources.JpegBrowser[i], actualBytes[i]); } }
public ActionResult PrintJpg(DashboardRequest request) { var model = new DashboardPrintModel { Summary = CreateSummary(request), Request = request }; return(PrintResult.PrintToJpeg("Print", model)); }
public ActionResult PrintJpg(int?id = null) { var model = CreateOverViewReportModel(id); return(PrintResult.PrintToJpeg("Print", model)); }
public ActionResult PrintJpg(ComparisonChartRequestModel request) { var model = CreatePrintModel(request); return(PrintResult.PrintToJpeg("Print", model)); }