public async Task AddingAnInvoice_ShouldBeSaved() { var invoiceItem = ApiDtoGenerator.InvoiceItemGenerator().Generate(); var apiResult = await _sut.Post(invoiceItem); using (new AssertionScope()) { apiResult.Result.Should().BeOfType <OkObjectResult>(); await _invoiceRepository.Received(1).AddAsync(Arg.Any <Invoice>()); } }
public void WhenMapFromInvoice_To_InvoiceDto_AllPropertiesShouldBeMapped() { var item = ApiDtoGenerator.InvoiceItemGenerator().Generate(); var entity = _sut.Map(item); using (new AssertionScope()) { item.Date.Should().Be(entity.Date); item.CustomerId.Should().Be(entity.Customer.Id); item.Summary.Should().Be(entity.Summary); item.TotalAmount.Should().Be(entity.TotalAmount); item.Id.Should().Be(entity.Id); } }