예제 #1
0
 public void TestGetMyOrders()
 {
     order3.AddDetails(orderDetails3);
     order3.AddDetails(orderDetails4);
     orderService.orderDict.Add(1, order1);
     orderService.orderDict.Add(2, order2);
     orderService.orderDict.Add(3, order3);
     Assert.IsTrue(orderService.GetMyOrders(1000).Contains(order3));
 }
예제 #2
0
 public void TestQueryByGoodsName()
 {
     order1.AddDetails(orderDetails1);
     order2.AddDetails(orderDetails2);
     orderService.orderDict.Add(1, order1);
     orderService.orderDict.Add(2, order2);
     Assert.IsTrue(orderService.QueryByGoodsName("apple").Contains(order1));
 }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     OrderList.Order       order    = new OrderList.Order();
     OrderList.Goods       good     = new OrderList.Goods();
     OrderList.OrderDetail detail   = new OrderList.OrderDetail();
     OrderList.Customer    customer = new OrderList.Customer();
     customer.Name   = customerName;
     customer.Id     = customerId;
     good.Name       = goodsName;
     good.Id         = goodsId;
     good.Price      = price;
     detail.Quantity = quantity;
     detail.Goods    = good;
     order.AddDetails(detail);
     order.Customer = customer;
     order.Id       = i;
     OrderList.OrderService service = new OrderList.OrderService();
     service.AddOrder(order);
     i++;
     DialogResult result = MessageBox.Show("订单添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 }