예제 #1
0
        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]);
            }
        }
예제 #2
0
        public ActionResult PrintJpg(DashboardRequest request)
        {
            var model = new DashboardPrintModel
            {
                Summary = CreateSummary(request),
                Request = request
            };

            return(PrintResult.PrintToJpeg("Print", model));
        }
예제 #3
0
        public ActionResult PrintJpg(int?id = null)
        {
            var model = CreateOverViewReportModel(id);

            return(PrintResult.PrintToJpeg("Print", model));
        }
예제 #4
0
        public ActionResult PrintJpg(ComparisonChartRequestModel request)
        {
            var model = CreatePrintModel(request);

            return(PrintResult.PrintToJpeg("Print", model));
        }