Пример #1
0
        public void PrintBusinessOrderBill()
        {
            IOrder testOrder = new BusinessOrder()
            {
                OrderId             = 20,
                Name                = "TestBusinessOrder",
                Price               = 150.5,
                BusinessCompanyCode = "TB128"
            };

            var expectedResult = "Order Bill Details:\n OrderId: 20\n Name: TestBusinessOrder\n Price: 150.5\n";
            var sut            = new Billable <IOrder>(testOrder);
            var actualResult   = sut.PrintBill();

            Assert.That(actualResult.Equals(expectedResult));
        }
Пример #2
0
        public void PrintOrderBill()
        {
            IOrder testOrder = new Order()
            {
                OrderId = 15,
                Name    = "TestOrder",
                Price   = 10.5,
                Sex     = "F"
            };

            var expectedResult = "Order Bill Details:\n OrderId: 15\n Name: TestOrder\n Price: 10.5\n";
            var sut            = new Billable <IOrder>(testOrder);
            var actualResult   = sut.PrintBill();

            Assert.That(actualResult.Equals(expectedResult));
        }
Пример #3
0
        static void Main(string[] args)
        {
            var orderAggregator = new OrderAggregator();
            var orderList       = orderAggregator.OrderList;
            var orderArray      = orderAggregator.OrderArray;

            Action <string> printAction = (x) => Console.WriteLine($"*****Order {x} Calculations*****");

            var orderBillable = new Billable <IOrder>(orderList.Find(order => order.OrderId == 1));
            var businessOrder = new BusinessOrder()
            {
                OrderId             = 100,
                BusinessCompanyCode = "LSLI100SL",
                Name  = "LaserLine Print Ltd",
                Price = 800.5
            };
            var businessOrderBillable = new Billable <IOrder>(businessOrder);

            printAction.Invoke("List");
            Console.Write(orderAggregator.CalculateAll(orderList));
            Console.WriteLine("*********************************\n");

            printAction.Invoke("Array");
            Console.Write(orderAggregator.CalculateAll(orderArray));
            Console.WriteLine("*********************************\n");

            Console.WriteLine("*****Simple Order Dictionary Calculations*****");
            Console.Write(orderAggregator.SimpleCalculateAllFromDictionary());
            Console.WriteLine("*********************************\n");

            Console.WriteLine("*****Bill Details for Order*****");
            Console.Write(orderBillable.PrintBill());
            Console.WriteLine("*********************************\n");

            Console.WriteLine("*****Bill Details for Business Order*****");
            Console.Write(businessOrderBillable.PrintBill());
            Console.WriteLine("*********************************\n");

            Console.ReadLine();
        }