Esempio n. 1
0
        public void build_invoice_with_nested_builders()
        {
            Invoice invoice = InvoiceBuilder.AnInvoice()
                              .WithRecipient(RecipientBuilder.ARecipient().WithAddress(AddressBuilder.AnAddress().WithCity("London")))
                              .WithInvoiceLines(InvoiceLineBuilder.AnInvoiceLine().WithProduct("Boots"),
                                                InvoiceLineBuilder.AnInvoiceLine().WithProduct("Cape"))
                              .Build();

            Assert.That(invoice.recipient.address.city, Is.EqualTo("London"));
            Assert.That(invoice.lines.invoiceLines[1].product, Is.EqualTo("Cape"));
        }