public void Refund(int currentTotal, int?priceInCents) { var calculator = new RefundCalculator(); var refund = calculator.CalculateRefund(priceInCents ?? 0, currentTotal); foreach (var coinCount in refund) { ReturnTray.AddRange(Enumerable.Repeat(coinCount.Key, coinCount.Value)); } }
public void ReturnCoins() { ReturnTray.AddRange(CoinSlot); CoinSlot.Clear(); Context.State = new NoMoneyState(this); }