public void Can_set_current_player_bank_account() { var data = CreatePlayerBankAccountData(); var player = _paymentRepository.Players.First(); data.PlayerId = player.Id; var bank = _paymentRepository.Banks.First(); data.Bank = bank.Id; data.AccountName = player.GetFullName(); _playerBankAccountCommands.Add(data); var newData = CreatePlayerBankAccountData(); newData.PlayerId = player.Id; newData.Bank = bank.Id; newData.AccountName = player.GetFullName(); _playerBankAccountCommands.Add(newData); var newPlayerBankAccount = _paymentRepository.PlayerBankAccounts.First(x => x.AccountName == newData.AccountName); _playerBankAccountCommands.SetCurrent(newPlayerBankAccount.Id); newPlayerBankAccount = _paymentRepository.PlayerBankAccounts.First(x => x.AccountName == newData.AccountName); Assert.That(newPlayerBankAccount.IsCurrent, Is.True); }
public IHttpActionResult SetCurrentBankAccount(SetCurrentPlayerBankAccountData data) { VerifyPermission(Permissions.Update, Modules.PlayerBankAccount); var validationResult = _playerBankAccountCommands.ValidateThatPlayerBankAccountCanBeSet(data); if (!validationResult.IsValid) { return(Ok(ValidationExceptionResponse(validationResult.Errors))); } _playerBankAccountCommands.SetCurrent(data.PlayerBankAccountId); return(Ok(new { Result = "success" })); }