public void CantBuyIfCountEqualsZero() { Init(); Drink1.CostPrice = 10; Drink1.Count = 0; Coin1.Count = 10; Coin1.Value = ValueCoins.Ten; VengineMachine.AddCoin(Coin1, CurrentState); Assert.IsFalse(VengineMachine.IsCanBuy(Drink1, CurrentState)); }
public JsonBase IsCanBuy(Guid id) { DrinkEntity drink = _drinkRepository.Get(id); CurrentStateEntity currentState = _stateRepository.GetFirst(); _printer.DrinkAndStateInfo(drink, currentState); if (!_vengineMachine.IsCanBuy(drink, currentState)) { var msg = " Сумма недостаточна для покупки!"; _logger.Warning(msg); return(new JsonError(msg)); } return(new JsonSuccess()); }
public void CantBuyIfDepositLowerThanCost() { Init(); Drink1.CostPrice = 10; Drink1.Count = 1; Coin2.Count = 10; Coin2.Value = ValueCoins.Two; VengineMachine.AddCoin(Coin2, CurrentState); Assert.IsFalse(VengineMachine.IsCanBuy(Drink1, CurrentState)); Coin1.Count = 10; Coin1.Value = ValueCoins.Ten; VengineMachine.AddCoin(Coin1, CurrentState); Assert.IsTrue(VengineMachine.IsCanBuy(Drink1, CurrentState)); }