def run_simulation(self):
     """The central method called in main.py."""
     customer = Customer()
     soda_machine = SodaMachine()
     will_proceed = False
     while will_proceed:
         user_option = user_interface.simulation_main_menu()
         if user_option = "1":
             soda_machine.begin_transaction(customer)
         elif user_option = "2":
             customer.check_coins_in_wallet()
 def run_simulation():
     """The central method called in main.py."""
     customer = Customer()
     soda_machine = SodaMachine()
     while True:
         user_option = user_interface.simulation_main_menu()
         if user_option == 1:
             soda_machine.begin_transaction(customer)
         elif user_option == 2:
             customer.check_coins_in_wallet()
         elif user_option == 3:
             customer.check_backpack()
         elif user_option == 4:
             quit()
Ejemplo n.º 3
0
 def run_simulation(self):
     """The central method called in main.py."""
     customer = Customer()
     soda_machine = SodaMachine()
     will_proceed = False
     if not will_proceed:
         user_option = user_interface.simulation_main_menu()
         if user_option == 1:
             soda_machine.begin_transaction(customer)
         elif user_option == 2:
             customer.check_coins_in_wallet()
         elif user_option == 3:
             customer.check_backpack()
         else:
             will_proceed = False
             return will_proceed
Ejemplo n.º 4
0
class Simulation:
    def __init__(self):
        self.customer = Customer()
        self.soda_machine = SodaMachine()
        pass

    def run_simulation(self):
        """The central method called in main.py."""
        will_proceed = True
        while will_proceed:
            user_option = user_interface.simulation_main_menu()
            if user_option == 1:
                self.soda_machine.begin_transaction(self.customer)
            elif user_option == 2:
                self.customer.check_coins_in_wallet()
            elif user_option == 3:
                self.customer.check_backpack()
            else:
                will_proceed = False
Ejemplo n.º 5
0
 def run_simulation(self):
     """The central method called in main.py."""
     customer = Customer()
     soda_machine = SodaMachine()
     soda_machine.fill_inventory()
     soda_machine.fill_register()
     will_proceed = True
     while will_proceed:
         user_option = user_interface.simulation_main_menu()
         if user_option == 0:
             soda_machine.begin_transaction(customer)
         elif user_option == 1:
             customer.check_coins_in_wallet()
         elif user_option == 2:
             customer.check_backpack()
         elif user_option == 3:
             will_proceed = False
Ejemplo n.º 6
0
def soda_machine():
    return SodaMachine.start([("Coke", 10, 10)], "visa_server", "username",
                             "password")
Ejemplo n.º 7
0
def test_create_soda_machine_with_invalid_params(drink_name, amount, price):
    with pytest.raises(Exception):
        SodaMachine.start([(drink_name, amount, price)])
Ejemplo n.º 8
0
def test_create_soda_machine():
    machine = SodaMachine.start([("Coke", 10, 10)], "visa_server", "username",
                                "password")
    assert "Coke" in machine.drinks, "Coke is missing in machine"
    assert machine.drinks["Coke"].price == 10, "Wrong price was set to Coke"
    assert machine.drinks["Coke"].amount == 10, "Wrong amount was set to Coke"
Ejemplo n.º 9
0
 def __init__(self):
     self.customer = Customer()
     self.soda_machine = SodaMachine()
     pass
Ejemplo n.º 10
0
from soda_machine import SodaMachine

if __name__ == "__main__":
    mm = SodaMachine()
    mm.load_machine()