public void shouldSuccessPDFTemplateItemMoreThanOne() { VBRealizationDocumentNonPOPDFTemplate PdfTemplate = new VBRealizationDocumentNonPOPDFTemplate(); MemoryStream result = PdfTemplate.GeneratePdfTemplate(VBRealizationDocumentItemMoreThanOneViewModel, 7); Assert.NotNull(result); }
public async Task <IActionResult> GetPDFNonPO([FromRoute] int id) { try { var indexAcceptPdf = Request.Headers["Accept"].ToList().IndexOf("application/pdf"); int timeoffsset = Convert.ToInt32(Request.Headers["x-timezone-offset"]); var data = await _service.ReadByIdAsync(id); if (data == null) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.NOT_FOUND_STATUS_CODE, General.NOT_FOUND_MESSAGE) .Fail(); return(NotFound(Result)); } else { VBRealizationDocumentNonPOPDFTemplate PdfTemplate = new VBRealizationDocumentNonPOPDFTemplate(); MemoryStream stream = PdfTemplate.GeneratePdfTemplate(data, timeoffsset); return(new FileStreamResult(stream, "application/pdf") { FileDownloadName = $"Realisasi VB Tanpa PO - {data.DocumentNo}.pdf" }); } } catch (Exception e) { Dictionary <string, object> Result = new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, Result)); } }
public void shouldSuccessPDFTemplateWithPPHAndPPNNull() { VBRealizationDocumentNonPOPDFTemplate PdfTemplate = new VBRealizationDocumentNonPOPDFTemplate(); MemoryStream result = PdfTemplate.GeneratePdfTemplate(VBRealizationDocumentNonPONullPPHandPPNViewModel, 7); Assert.NotNull(result); }