Beispiel #1
0
        public void VerifyOrderSubTotal()
        {
            var order = new Order();
            order.Items.Add(new OrderItem() { Price = 18m });
            order.Items.Add(new OrderItem() { Price = 15.5m });
            order.Items.Add(new OrderItem() { Price = 13m });

            Assert.AreEqual(46.50m, order.SubTotal);
        }
Beispiel #2
0
        public void VerifyOrderTotal()
        {
            var order = new Order();
            order.Items.Add(new OrderItem() { Price = 18m });
            order.Items.Add(new OrderItem() { Price = 15.5m });
            order.Items.Add(new OrderItem() { Price = 13m });
            order.Taxes.Add(new TaxItem() { Rate = .05 });

            Assert.AreEqual(48.83m, order.Total);
        }
Beispiel #3
0
 public void VerifyNewOrder()
 {
     try
     {
         var order = new Order();
     }
     catch (Exception ex)
     {
         Assert.Fail(string.Format("Unexpected exception was thrown: {0}", ex.ToString()));
     }
 }
        public void VerifyOrderItemFormat()
        {
            var desc = "something-something";
            var taxName = "GST";

            var order = new Order();
            order.Items.Add(new OrderItem() { Price = 18m, Description = desc });
            order.Items.Add(new OrderItem() { Price = 15.5m });
            order.Items.Add(new OrderItem() { Price = 13m });
            order.Taxes.Add(new TaxItem() { Rate = .05, Name = taxName });

            Console.WriteLine();
            Console.WriteLine("-----------");
            Console.WriteLine(order.Print());
            Console.WriteLine("-----------");

            Assert.IsTrue(order.Print().Contains(desc));
            Assert.IsTrue(order.Print().Contains(taxName));
            Assert.IsTrue(order.Print().Contains("Subtotal: $46.5"));
            Assert.IsTrue(order.Print().Contains("GST: $2.33"));
            Assert.IsTrue(order.Print().Contains("Total: $48.83"));
        }
 static PizzaApplication()
 {
     order = new Order();
     priceEngine = new PriceEngine();
     taxEngine = new TaxEngine();
 }