public async void ShouldReturnAccounts() { var userId = "test-user"; var refresh = false; var mLogger = new Mock <ILogger <AccountController> >(); var config = new Mock <IConfiguration>(); var mTlApi = new Mock <ConcreteTrueLayerDataApi>(config.Object); var mConsentSvc = new Mock <IConsentService>(); var mAcctRepo = new Mock <IRepository <List <Account>, string> >(); var accts = new List <Account>(); mAcctRepo.Setup(x => x.Unused()).Returns(false); mAcctRepo.Setup(x => x.Get(userId)).Returns(accts); var mTxnRepo = new Mock <ITransactionRepository <Transaction, string> >(); var acctService = new AccountService(mTlApi.Object, mConsentSvc.Object, mAcctRepo.Object, mTxnRepo.Object); var acctController = new AccountController(mLogger.Object, acctService); var accounts = await acctController.Accounts(userId, refresh); Assert.Equal(accts, accounts); }
public async Task TestForAccounts() { Mock <IAccount> mock = new Mock <IAccount>(); var testController = new AccountController(mock.Object); var getAccounts = await testController.Accounts(); Assert.IsNotNull(getAccounts); Assert.IsNotNull(getAccounts.Model); Assert.IsTrue(string.IsNullOrEmpty(getAccounts.ViewName) || getAccounts.ViewName == "Accounts"); }