Esempio n. 1
0
        public async Task <IActionResult> GetPdf(InvoiceInputModel input)
        {
            //TODO service after details are clear
            //var model = this.invoice.GetViewModelAsync(input);
            var model    = new InvoiceOutputModel();
            var htmlData = await this.viewRenderService.RenderToStringAsync("~/Views/Dashboard/GetPdf.cshtml", model);

            var fileContents = this.htmlToPdfConverter.Convert(htmlData);

            return(this.File(fileContents, "application/pdf"));
        }
        public async Task GetViewModelAsync_ShouldThrow_NotImplemetedException()
        {
            var invoiceService = new InvoicesService();
            var inputModel     = new InvoiceInputModel()
            {
                Name = "Firma Frma", Price = 800
            };

            Action act = () => invoiceService.GetViewModelAsync(inputModel);

            act
            .Should()
            .ThrowExactly <InvalidOperationException>()
            .WithMessage("Not impelmented");
        }
 public Task <InvoiceOutputModel> GetViewModelAsync(InvoiceInputModel model)
 => throw new InvalidOperationException("Not impelmented");