Exemplo n.º 1
0
 private VendingMachineCore GetVendingMachine()
 {
     var vendingInitState = new VendingInitState();
     vendingInitState.SetCoins(1, 100);
     vendingInitState.SetCoins(2, 100);
     vendingInitState.SetCoins(5, 100);
     vendingInitState.SetCoins(10, 100);
     vendingInitState.AddProduct("Чай", 13, 10);
     vendingInitState.AddProduct("Кофе", 18, 20);
     vendingInitState.AddProduct("Кофе с молоком", 21, 20);
     vendingInitState.AddProduct("Сок", 35, 15);
     return new VendingMachineCore(vendingInitState);
 }
Exemplo n.º 2
0
        private void InitData()
        {
            var vendingInitState = new VendingInitState();
            vendingInitState.SetCoins(1, 100);
            vendingInitState.SetCoins(2, 100);
            vendingInitState.SetCoins(5, 100);
            vendingInitState.SetCoins(10, 100);
            vendingInitState.AddProduct("Чай", 13, 10);
            vendingInitState.AddProduct("Кофе", 18, 20);
            vendingInitState.AddProduct("Кофе с молоком", 21, 20);
            vendingInitState.AddProduct("Сок", 35, 15);
            vendingMachineCore = new VendingMachineCore(vendingInitState);

            user = new User();
            user.Purse.SetCoins(1, 10);
            user.Purse.SetCoins(2, 30);
            user.Purse.SetCoins(5, 20);
            user.Purse.SetCoins(10, 15);

            Session["vm"] = vendingMachineCore;
            Session["user"] = user;
        }