Exemplo n.º 1
0
def test_MKOrder_alt3(sys):
    burger1 = Burger()
    whiteBun1 = Ingredient('White Bun', sys.getStockBasePrice('White Bun'), 4)
    beefPatty1 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2)
    lettuce1 = Ingredient("Lettuce", sys.getStockBasePrice("Lettuce"), 3)

    error1 = burger1.addBuns(whiteBun1)
    error2 = burger1.addPatties(beefPatty1)
    burger1.addIngredient(lettuce1)

    assert error1 == None
    assert error2 == None
    assert burger1.calculatePrice() == 31

    wrap1 = Wrap()
    wholemealWrap1 = Ingredient('Wholemeal Wrap', sys.getStockBasePrice('Wholemeal Wrap'), 1)
    chickenPatty2 = Ingredient("Chicken Patty", sys.getStockBasePrice('Chicken Patty'), 2)

    error3 = wrap1.addWrap(wholemealWrap1)
    error4 = wrap1.addPatties(chickenPatty2)

    assert error3 == None
    assert error4 == None
    assert wrap1.calculatePrice() == 11

    # order.addMain(burger1)
    # order.addMain(wrap1)
    print("======= receipt ========")
    order2 = sys.makeOrder([burger1, wrap1], [], "preparing", 4)
    print('========================')
    assert order2.totalPrice() == 42
    print("test 4 passed")
Exemplo n.º 2
0
def test_MKOrder_alt2(sys):
    order = Order('parparing',3)
    burger1 = Burger()
    whiteBun1 = Ingredient('White Bun',sys.getStockBasePrice('White Bun'),5)
    beefPatty1 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 8)
    lettuce1 = Ingredient("Lettuce", sys.getStockBasePrice('Lettuce'),3)

    error1 = burger1.addBuns(whiteBun1)
    error2 = burger1.addPatties(beefPatty1)
    burger1.addIngredient(lettuce1)

    print("=======error=======")
    print(error1)
    print(error2)
    print('===================')
    print('test 3 passed')
Exemplo n.º 3
0
def test_us3_245(sys):

    # make a burger
    burger32 = Burger()
    whiteBun32 = Ingredient('White Bun', sys.getStockBasePrice('White Bun'), 4)
    beefPatty32 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2)
    lettuce32 = Ingredient("Lettuce", sys.getStockBasePrice("Lettuce"), 4)
    burger32.addBuns(whiteBun32)
    burger32.addPatties(beefPatty32)
    burger32.addIngredient(lettuce32)

    burger_price = burger32.calculatePrice()
    assert burger_price == 32

    #make a wrap
    wrap32 = Wrap()
    wholemealWrap32 = Ingredient('Wholemeal Wrap', sys.getStockBasePrice('Wholemeal Wrap'), 1)
    chickenPatty32 = Ingredient("Chicken Patty", sys.getStockBasePrice('Chicken Patty'), 2)
    beefPatty3 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 1)
    wrap32.addIngredient(wholemealWrap32)
    wrap32.addPatties(chickenPatty32)
    wrap32.addPatties(beefPatty3)

    wrap_price = wrap32.calculatePrice()
    assert wrap_price == 21

    drink32 = Extra()
    coke32 = Ingredient("Small Coca Cola", sys.getStockBasePrice("Can Coca Cola"), 2)
    drink32.addExtra(coke32)
    assert coke32.quantity == 2

    drink_price = drink32.calculatePrice()
    assert drink_price == 6
    print("========= receipt ===========")
    order = sys.makeOrder([burger32,wrap32], [drink32],'Preparing', 4)
    print("=============================")
    assert order.totalPrice() == 59
    #assert len([]) == 2
    #assert len(order32.extraFoods) == 1
    #totalPrice = order32.totalPrice()
    #assert totalPrice == 59

    print("test us3_245 have finished\n")
Exemplo n.º 4
0
def test_us4_1_2(sys):

    # order some drinks
    drink412 = Extra()
    fanta1 = Ingredient('Fanta', sys.getStockBasePrice('Fanta'), 5)
    drink412.addExtra(fanta1)

    # order a burger
    burger412 = Burger()
    whiteBun412 = Ingredient('White Bun', sys.getStockBasePrice('White Bun'), 4)
    beefPatty412 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2)
    lettuce412 = Ingredient("Lettuce", sys.getStockBasePrice("Lettuce"), 3)
    burger412.addIngredient(whiteBun412)
    burger412.addIngredient(lettuce412)
    burger412.addPatties(beefPatty412)

    # order a side
    side412 = Extra()
    frenchFries412 = Ingredient("friess",sys.getStockBasePrice('Small French Fries'),2)
    side412.addExtra(frenchFries412)
    print("========= receipt ===========")
    o = sys.makeOrder([burger412],[drink412,side412],'preparing',6)
    assert o.totalPrice() == 52
    print("test us4_1_2 has finished \n")
Exemplo n.º 5
0
burger.addBuns(muffinBun1)
burger.addPatties(beefPatty1)

side = Extra()
chickenNuggetL1 = Ingredient('Large Chicken Nuggets',
                             sys.getStockBasePrice("Large Chicken Nuggets"), 1)
side.addExtra(chickenNuggetL1)
order1 = sys.makeOrder([burger], [side], 'Preparing', 1)

burger32 = Burger()
whiteBun32 = Ingredient('White Bun', sys.getStockBasePrice('White Bun'), 4)
beefPatty32 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 2)
lettuce32 = Ingredient("Lettuce", sys.getStockBasePrice("Lettuce"), 4)
burger32.addBuns(whiteBun32)
burger32.addPatties(beefPatty32)
burger32.addIngredient(lettuce32)

burger_price = burger32.calculatePrice()
assert burger_price == 32

# make a wrap
wrap32 = Wrap()
wholemealWrap32 = Ingredient('Wholemeal Wrap',
                             sys.getStockBasePrice('Wholemeal Wrap'), 1)
chickenPatty32 = Ingredient("Chicken Patty",
                            sys.getStockBasePrice('Chicken Patty'), 2)
beefPatty3 = Ingredient("Beef Patty", sys.getStockBasePrice('Beef Patty'), 1)
wrap32.addIngredient(wholemealWrap32)
wrap32.addPatties(chickenPatty32)
wrap32.addPatties(beefPatty3)
wrap_price = wrap32.calculatePrice()