Пример #1
0
        public static void Assignment6()
        {
            Invoice invoice = new Invoice() { Customer = "Kirsi Kernel" };
            invoice.Items.Add(new InvoiceItem() { Name = "Milk", Price = 1.75, Quantity = 1 });
            invoice.Items.Add(new InvoiceItem() { Name = "Beer", Price = 5.25, Quantity = 1 });
            invoice.Items.Add(new InvoiceItem() { Name = "Butter", Price = 2.50, Quantity = 2 });

            invoice.PrintInvoice();
        }
Пример #2
0
        public void TotalTest()
        {
            Invoice invoice = new Invoice() { Customer = "Kirsi Kernel" };
            invoice.Items.Add(new InvoiceItem() { Name = "Milk", Price = 1.75, Quantity = 1 });
            invoice.Items.Add(new InvoiceItem() { Name = "Beer", Price = 5.25, Quantity = 1 });
            invoice.Items.Add(new InvoiceItem() { Name = "Butter", Price = 2.50, Quantity = 2 });

            double expected = 1.75 + 5.25 + 2.50 * 2;
            double actual = invoice.Total;
            Assert.AreEqual(expected, actual);
        }