예제 #1
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");
            }
        }
예제 #2
0
        public async Task Should_Throw_Argument_Exception_For_Invalid_Model()
        {
            //Arrange

            //Action
            Func<Task> func = () => _service.UpdatePdfInvoice(_invoiceDirectory, _templateRootPath, null);

            //Assert
            await func.Should().ThrowAsync<ArgumentNullException>();
        }