Exemplo n.º 1
0
        public void Execute_WhenValidInputTo_ShouldRespondWithPdfContentType()
        {
            //---------------Arrange-------------------
            var gatewayResult = new RenderedDocumentOutput {
                Base64String = "eA=="
            };
            var pdfGateway = Create_Report_Gateway(gatewayResult);

            var input = new RenderPdfInput {
                Base64DocxReport = "cHVzc3k=", FileName = "report.docx"
            };
            var presenter = new PropertyPresenter <IFileOutput, ErrorOutput>();

            var usecase = new RenderWordToPdfUseCase(pdfGateway);

            //---------------Act----------------------
            usecase.Execute(input, presenter);
            //---------------Assert-----------------------
            Assert.Equal("application/pdf", presenter.SuccessContent.ContentType);
        }
Exemplo n.º 2
0
        public void Execute_WhenRenderErrors_ShouldRespondWithErrors()
        {
            //---------------Arrange-------------------
            var gatewayResult = new RenderedDocumentOutput {
                ErrorMessages = new List <string> {
                    "error"
                }
            };
            var pdfGateway = Create_Report_Gateway(gatewayResult);

            var input = new RenderPdfInput {
                Base64DocxReport = "cHVzc3k=", FileName = "report.docx"
            };
            var presenter = new PropertyPresenter <IFileOutput, ErrorOutput>();

            var usecase = new RenderWordToPdfUseCase(pdfGateway);

            //---------------Act----------------------
            usecase.Execute(input, presenter);
            //---------------Assert-----------------------
            Assert.True(presenter.IsErrorResponse());
        }