class OrderDetailTest(unittest.TestCase): def setUp(self): self.orderdetail = OrderDetail(Item, '3') def test_getQuantity(self): self.assertEqual(self.orderdetail.getQuantity(), '3') def test_getItem(self): self.assertEqual(self.orderdetail.getItem(), Item)
class OrderTest(unittest.TestCase): def setUp(self): self.orderdetails = OrderDetail(23, 2, '2019-06-13', 'Complete') def test_getOrderStatus(self): self.assertEqual(self.orderdetails.getOrderStatus(), 'Complete') def test_getQuantity(self): self.assertEqual(self.orderdetails.getQuantity(), 2) def test_getDate(self): self.assertEqual(self.orderdetails.getOrderDate(), '2019-06-13')
def setUp(self): self.o=Order() self.menuitem1=Menu(3,'cheese stick', 2.10) self.menuitem2=Menu(42,'dessert', 10.00) self.orderitem1=OrderDetail(self.menuitem1,1) self.orderitem2=OrderDetail(self.menuitem2,3) #self.orderitem3=OrderDetail(self.menuitem3,2) self.o.addOrderItems(self.orderitem1) self.o.addOrderItems(self.orderitem2)
class OrderdetailTest(unittest.TestCase): def setUp(self): self.menu=Menu(2,'salad', 2.75) self.quantity=2 self.orderdetail=OrderDetail(self.menu, self.quantity) def test_getMenuItem(self): self.menu = self.orderdetail.getMenuItem() self.assertEqual(str(self.menu),'salad') def test_geMenutItemPriceFromOrderItem(self): self.menu = self.orderdetail.getMenuItem() self.assertEqual(self.menu.getMenuItemPrice(), 2.75) def test_getQuantity(self): self.assertEqual(self.orderdetail.getQuantity(),2)
def main(): selection1 = Menu(1, 'Grilled Salmon', 11.20) selection2 = Menu(2, 'Frensh Fries', 5.00) selection3 = Menu(3, 'Coke', 2.00) orderdetail1 = OrderDetail(selection1, 1) orderdetail2 = OrderDetail(selection2, 2) orderdetail3 = OrderDetail(selection3, 1) order = Order() order.addOrderItems(orderdetail1) order.addOrderItems(orderdetail2) order.addOrderItems(orderdetail3) payment = order.calcTotal() print(payment)
def setUp(self): self.orderdetail = OrderDetail(Item, '3')
def setUp(self): self.orderdetails = OrderDetail(23, 2, '2019-06-13', 'Complete')
def setUp(self): self.menu=Menu(2,'salad', 2.75) self.quantity=2 self.orderdetail=OrderDetail(self.menu, self.quantity)