Пример #1
0
        public async Task Should_Throw_Argument_Exception_For_Invalid_File_Directory()
        {
            //Arrange
            string invoiceDirectory = string.Empty;
            string templateRootPath = string.Empty;

            //Action
            Func<Task> func = () => _service.CreatePdfInvoice(invoiceDirectory, templateRootPath, _feed.Items[0]);

            //Assert
            await func.Should().ThrowAsync<ArgumentNullException>();
        }
Пример #2
0
        private async Task ProcessInvoiceItem(Event eventItem, string invoiceDirectory, string templatePath)
        {
            if (eventItem != null && !string.IsNullOrEmpty(invoiceDirectory) && !string.IsNullOrEmpty(templatePath))
            {
                _logger.LogInformation("Processing invoice item ID: {0}", eventItem.ID);
                switch (eventItem.Type)
                {
                case EventType.INVOICE_CREATED:
                    await _pdfService.CreatePdfInvoice(invoiceDirectory, templatePath, eventItem);

                    break;

                case EventType.INVOICE_UPDATED:
                    await _pdfService.UpdatePdfInvoice(invoiceDirectory, templatePath, eventItem);

                    break;

                case EventType.INVOICE_DELETED:
                    await _pdfService.DeletePdfInvoice(invoiceDirectory, eventItem);

                    break;
                }
            }
            else
            {
                throw new ArgumentNullException("Invalid arguments when processing invoice item");
            }
        }