コード例 #1
0
        public void QueryByCustomerNameTest()
        {
            Customer customer1 = new Customer(1, "GYJ");
            Customer customer2 = new Customer(2, "SYY");

            Good Dior   = new Good(1, "Dior", 330.5f);
            Good Chanel = new Good(2, "Chanel", 220.6f);
            Good TF     = new Good(3, "TF", 500.3f);

            Order order1 = new Order(1, customer1);

            order1.AddPurchase(new Purchase(Dior, 40));
            order1.AddPurchase(new Purchase(Chanel, 80));
            order1.AddPurchase(new Purchase(TF, 50));


            Order order2 = new Order(2, customer2);

            order2.AddPurchase(new Purchase(Dior, 40));
            order2.AddPurchase(new Purchase(TF, 50));

            Order order3 = new Order(3, customer1);

            order3.AddPurchase(new Purchase(Dior, 450));

            ordersTable.AddOrder(order1);
            ordersTable.AddOrder(order2);
            ordersTable.AddOrder(order3);

            Assert.AreEqual(ordersTable.QueryByCustomerName("GYJ").Count, 2);
            Assert.AreEqual(ordersTable.QueryByCustomerName("SYY").Count, 1);
        }