public CoinBalance Accumulate(CoinBalance current, int winnings) { if (winnings <= 0) { throw new ArgumentException(); } return(new CoinBalance(current.Value + winnings)); }
public void GivenValidInitialBalance_WhenAccumulating_FinalBalance_IsSumOfInitialValueAndWinnings(int initial, int winnings) { var coinService = new CoinService(); var initialBalance = new CoinBalance(initial); var finalBalance = coinService.Accumulate(initialBalance, winnings); Assert.That(finalBalance, Is.EqualTo(new CoinBalance(initial + winnings))); }
public bool WhenWinThresholdIsReached_HasWinningThresholdBeenReached_ReturnsTrue(int winnings) { var coinService = new CoinService(); var currentBalance = new CoinBalance(4); var winningBalance = coinService.Accumulate(currentBalance, winnings); return(coinService.HasWinningThresholdBeenReached(winningBalance)); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.payDate) { hashcode = (hashcode * 397) + PayDate.GetHashCode(); } if (__isset.coinBalance) { hashcode = (hashcode * 397) + CoinBalance.GetHashCode(); } if (__isset.coin) { hashcode = (hashcode * 397) + Coin.GetHashCode(); } if (__isset.price) { hashcode = (hashcode * 397) + Price.GetHashCode(); } if (__isset.title) { hashcode = (hashcode * 397) + Title.GetHashCode(); } if (__isset.refund) { hashcode = (hashcode * 397) + Refund.GetHashCode(); } if (__isset.paySeq) { hashcode = (hashcode * 397) + PaySeq.GetHashCode(); } if (__isset.currency) { hashcode = (hashcode * 397) + Currency.GetHashCode(); } if (__isset.currencySign) { hashcode = (hashcode * 397) + CurrencySign.GetHashCode(); } if (__isset.displayPrice) { hashcode = (hashcode * 397) + DisplayPrice.GetHashCode(); } if (__isset.payload) { hashcode = (hashcode * 397) + Payload.GetHashCode(); } if (__isset.channelId) { hashcode = (hashcode * 397) + ChannelId.GetHashCode(); } } return(hashcode); }
public override string ToString() { var sb = new StringBuilder("CoinHistory("); bool __first = true; if (__isset.payDate) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("PayDate: "); PayDate.ToString(sb); } if (__isset.coinBalance) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("CoinBalance: "); CoinBalance.ToString(sb); } if (__isset.coin) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Coin: "); Coin.ToString(sb); } if (Price != null && __isset.price) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Price: "); Price.ToString(sb); } if (Title != null && __isset.title) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Title: "); Title.ToString(sb); } if (__isset.refund) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Refund: "); Refund.ToString(sb); } if (PaySeq != null && __isset.paySeq) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("PaySeq: "); PaySeq.ToString(sb); } if (Currency != null && __isset.currency) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Currency: "); Currency.ToString(sb); } if (CurrencySign != null && __isset.currencySign) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("CurrencySign: "); CurrencySign.ToString(sb); } if (DisplayPrice != null && __isset.displayPrice) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("DisplayPrice: "); DisplayPrice.ToString(sb); } if (Payload != null && __isset.payload) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Payload: "); Payload.ToString(sb); } if (ChannelId != null && __isset.channelId) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("ChannelId: "); ChannelId.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
public bool HasWinningThresholdBeenReached(CoinBalance currentBalance) { return(currentBalance.Value >= WinThreshold); }