public TransactionManager(AddTransactionViewModel addTransactionViewModel, IRepository<Account> accountRepository, SettingDataAccess settings) { this.addTransactionViewModel = addTransactionViewModel; this.accountRepository = accountRepository; this.settings = settings; }
public void AddTransactionViewModel_ReturnAddTransferTitle() { var dbHelper = new DbHelperStub(); var transactionRepository = new TransactionRepository(new TransactionDataAccess(dbHelper)) { Selected = new FinancialTransaction { Type = (int)TransactionType.Transfer } }; var viewModel = new AddTransactionViewModel(transactionRepository, new AccountRepository(new AccountDataAccess(dbHelper)), new SettingDataAccess(), new NavigationServiceStub(), new DialogServiceStub()) { IsEdit = false}; Assert.AreEqual("add transfer", viewModel.Title); }
public void GoToAddTransaction_Transfer_CorrectPreparation() { var dbHelper = new DbHelperStub(); var accountRepository = new AccountRepository(new AccountDataAccess(dbHelper)); var settings = new SettingDataAccess(); var addTransactionViewModel = new AddTransactionViewModel(new TransactionRepository(new TransactionDataAccess(dbHelper)), accountRepository, settings, new NavigationServiceStub(), new DialogServiceStub()); var transactionManager = new TransactionManager(addTransactionViewModel, accountRepository, settings); transactionManager.PrepareCreation("Transfer"); Assert.IsFalse(addTransactionViewModel.IsEdit); Assert.IsTrue(addTransactionViewModel.IsEndless); Assert.IsTrue(addTransactionViewModel.IsTransfer); Assert.AreEqual((int) TransactionType.Transfer, addTransactionViewModel.SelectedTransaction.Type); Assert.IsFalse(addTransactionViewModel.SelectedTransaction.IsExchangeModeActive); }
public void AddTransactionViewModel_ReturnIncomeDefault() { var dbHelper = new DbHelperStub(); var transactionRepository = new TransactionRepository(new TransactionDataAccess(dbHelper)) { Selected = new FinancialTransaction { Type = (int)TransactionType.Income } }; var viewModel = new AddTransactionViewModel(transactionRepository, new AccountRepository(new AccountDataAccess(dbHelper)), new SettingDataAccess(), new NavigationServiceStub(), new DialogServiceStub()); Assert.AreEqual("add income", viewModel.Title); }