public void Cannot_Call_Get_Snack_Pile_With_An_Invalid_Position(int position) { SnackMachine machine = new SnackMachine(); Action action = () => machine.GetSnackPile(position); action.Should().Throw <InvalidOperationException>(); }
public void Buysnack_trades_inserted_money_for_a_snack() { var snackMachine = new SnackMachine(); snackMachine.LoadSnacks(1, new SnackPile(Chocolate, 10, 1m)); snackMachine.InsertMoney(Dollar); snackMachine.BuySnack(1); snackMachine.MoneyInTransaction.Should().Be(0); snackMachine.MoneyInside.Amount.Should().Be(1m); snackMachine.GetSnackPile(1).Quantity.Should().Be(9); }
public void BuildSnack_ShouldTradesInsertedMoneyForASnack() { var snackMachine = new SnackMachine(); snackMachine.LoadSnack(1, new SnackPile(Soda, 10, 1)); snackMachine.InsertMoney(OneDollar); snackMachine.BuySnack(1); snackMachine.MoneyInside.Amount.Should().Be(1); snackMachine.MoneyInTransaction.Should().Be(0); snackMachine.GetSnackPile(1).Quantity.Should().Be(9); }
public void Buy_Snacks_Trades_Inserted_Money_For_A_Snack() { SnackMachine machine = new SnackMachine(); machine.LoadSnacks(1, new SnackPile(new Snack("Delicious Snack"), 4, 1)); machine.InsertMoney(Money.Dollar); machine.BuySnack(1); machine.AmountInTransaction.Should().Be(0m); machine.MoneyInside.Amount.Should().Be(1); machine.GetSnackPile(1).Quantity.Should().Be(3); }
public void BuySnack_trades_inserted_money_for_a_snack() { var snackMachine = new SnackMachine(); snackMachine.LoadSnacks(1, new SnackPile(Chocolate, 10, 1m)); snackMachine.InsertMoney(OneDollar); snackMachine.BuySnack(position: 1); //snackMachine.MoneyInTransaction.Should().Be(None); snackMachine.MoneyInTransaction.Should().Be(0); snackMachine.MoneyInside.Should().Be(OneDollar); //snackMachine.Slots.Single(x => x.Position == 1).Quantity.Should().Be(9); //snackMachine.GetQuantityOfSnacksInSlots(1).Quantity.Should().Be(9); snackMachine.GetSnackPile(1).Quantity.Should().Be(9); }
public void BuySnack_trades_inserted_money_for_a_snack() { //Arrange var snackMachine = new SnackMachine(); snackMachine.LoadSnacks(1, new SnackPile(Snack.None, 10, 1m)); snackMachine.InsertMoney(Dollar); //Act snackMachine.BuySnack(1); //Assert 0m.Should().Be(snackMachine.MoneyInTransaction); Dollar.Should().Be(snackMachine.MoneyInside); 9.Should().Be(snackMachine.GetSnackPile(1).Quantity); }