public void BuySnack_NoSnackAvailable_CannotBuy()
        {
            //Arrange
            var snackMachine = new SnackMachine();

            //Act
            var valid = snackMachine.CanBuySnack(1);

            //Assert
            false.Should().Equals(valid);
            true.Should().Equals(snackMachine.AnyErrors());
            Constants.NoSnackAvailableToBuy.Should().Equals(snackMachine.Project());
        }
        private void BuySnack(string position)
        {
            var pos = Convert.ToInt32(position);

            _mediator.Send(new BuySnackCommand(snackMachine, pos));

            if (snackMachine.AnyErrors())
            {
                Message = snackMachine.Project();
                return;
            }

            NotifyClient("You have bought a snack");
        }
        public void BuySnack_Cannot_buy_snack_if_not_enough_change_in_machine()
        {
            var snackMachine = new SnackMachine();

            snackMachine.LoadSnacks(1, new SnackPile(Snack.None, 1, 0.5m));
            snackMachine.InsertMoney(Dollar);

            var valid = snackMachine.CanBuySnack(1);

            //Assert
            false.Should().Equals(valid);
            true.Should().Equals(snackMachine.AnyErrors());
            Constants.NotEnoughChange.Should().Equals(snackMachine.Project());
        }
        public void BuySnack_Can_buy_snack_if_enough_change_in_machine()
        {
            var snackMachine = new SnackMachine(Dollar + Dollar);

            snackMachine.LoadSnacks(1, new SnackPile(Snack.None, 1, 3m));
            snackMachine.InsertMoney(FiveDollar);

            var valid = snackMachine.CanBuySnack(1);

            //Assert
            true.Should().Equals(valid);
            false.Should().Equals(snackMachine.AnyErrors());
            snackMachine.Project().Should().Be(string.Empty);
        }
        public void BuySnack_Cannot_NotEnoughMoneyInserted_CannotBuy()
        {
            //Arrange
            var snackMachine = new SnackMachine();

            snackMachine.LoadSnacks(1, new SnackPile(Snack.None, 1, 2m));

            //Action
            snackMachine.InsertMoney(Dollar);
            var valid = snackMachine.CanBuySnack(1);

            //Assert
            false.Should().Equals(valid);
            true.Should().Equals(snackMachine.AnyErrors());
            Constants.NotEnoughMoneyInserted.Should().Equals(snackMachine.Project());
        }