Ejemplo 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"));
        }
Ejemplo n.º 2
0
        public void build_invoice_with_no_postcode()
        {
            Invoice invoiceWithNoPostcode = InvoiceBuilder.AnInvoice()
                                            .WithRecipient(new RecipientBuilder()
                                                           .WithAddress(new AddressBuilder()
                                                                        .WithNoPostcode()
                                                                        .Build())
                                                           .Build())
                                            .Build();

            Assert.That(invoiceWithNoPostcode.recipient.address.postCode, Is.Null);
        }