public CurrentAccountService GetCurrentAccountService() { Mocker = new AutoMocker(); currentAccountService = Mocker.CreateInstance <CurrentAccountService>(); return(currentAccountService); }
public async Task RandomRequest() { var random = new Random(); var accounts = localDB.QueryAccounts().ToList(); var cards = localDB.QueryCards().ToList(); var number = random.NextDouble(); if (number < 0.5) { var service = new CurrentAccountService(executor, externalServices, localDB); var account = accounts[random.Next(accounts.Count)]; if (number < 0.25) { await service.Deposit(GetNextRequestId(), account, random.Next(100, 1000)); } else { await service.Withdraw(GetNextRequestId(), account, random.Next(100, 1000)); } } else { var service = new AlphaCardService(executor, externalServices, localDB); var card = cards[random.Next(cards.Count)]; if (number < 0.9) { await service.Pay(GetNextRequestId(), card, random.Next(100, 1000)); } else { await service.Fill(GetNextRequestId(), card, random.Next(100, 1000)); } } }
public void GettingNonNullStatementFromClientIdOne() { var currentAccountMock = new CurrentAccount() { ClientId = 1, CurrentAccountId = 1 }; var _currentAccountService = new CurrentAccountService(); double result = _currentAccountService.Statement(currentAccountMock); Assert.IsNotNull(result); }
public void MakingADepositToCurrentAccountIdTwo() { var transactionMock = new Transaction() { ClientId = 2, CurrentAccountId = 2, TransactionType = 1 }; var _currentAccountService = new CurrentAccountService(); var result = _currentAccountService.Transaction(transactionMock); Assert.IsTrue(result); }
public async Task Withdraw(string account, double amount) { var service = new CurrentAccountService(executor, externalServices, localDB); await service.Withdraw(GetNextRequestId(), account, amount); }