public AccountBrowserViewModel(IAccountRepository accountRepository, IAccountTagRepository accountTagRepository, IMainWindowViewModel mainWindow = null) { _accountRepository = accountRepository; _accountTagRepository = accountTagRepository; _mainWindow = mainWindow; _accounts = new ObservableCollection<AccountViewModel>(); }
public FileWriter(IAccountRepository accountRepository, IAccountTagRepository accountTagRepository, ITemplateRepository templateRepository, IJournalRepository journalRepository) { _accountRepository = accountRepository; _accountTagRepository = accountTagRepository; _templateRepository = templateRepository; _journalRepository = journalRepository; }
public AccountTagViewModel(AccountTag tag, IAccountTagRepository repository) { if (tag == null) throw new ArgumentNullException("tag"); if (repository == null) throw new ArgumentNullException("repository"); _tag = tag; _repository = repository; }
private static AccountRepository InitialiseAccountRepository(string accountDataPath, IAccountTagRepository accountTagRepository) { using (Stream accountStream = new FileStream(accountDataPath, FileMode.Open)) using (XmlReader accountXml = new XmlTextReader(accountStream)) { XElement accounts = XElement.Load(accountXml); return new AccountRepository(accountTagRepository); } }
public SpreadsheetImporter(IAccountTagRepository accountTagRepository, IAccountRepository accountRepository, IJournalRepository journalRepository) { _accountRepository = accountRepository; _journalRepository = journalRepository; foreach (var tag in accountTagRepository.GetAll()) { _accountTags.Add(tag.Name, tag); } }
public AccountViewModel(IAccountRepository accountRepository, IAccountTagRepository accountTagRepository) { if (accountRepository == null) throw new ArgumentNullException("accountRepository"); if (accountTagRepository == null) throw new ArgumentNullException("accountTagRepository"); //_mainWindow = mainWindow; _accountRepository = accountRepository; _accountTagRepository = accountTagRepository; _allTransactions = new Collection<TransactionViewModel>(); _visibleTransactions = new ObservableCollection<TransactionViewModel>(); }
public AccountMaintenenceViewModel(IAccountRepository accountRepository, IAccountTagRepository accountTagRepository) { _accountRepository = accountRepository; _accountTagRepository = accountTagRepository; ////_accountTags = new ObservableCollection<AccountTag>(_accountTagRepository.GetAll()); var accounts = _accountRepository.GetAll(); _accounts = new ObservableCollection<AccountViewModel>(); foreach (var account in accounts.OrderBy(x => x.Name)) AddAccountToInternalCollection(account); }
public void SetUp() { if (Directory.Exists(TestDirectory)) { Directory.Delete(TestDirectory, true); } Directory.CreateDirectory(TestDirectory); SetUpAccountRepositoryTestData(); _accountTagRepository = Substitute.For<IAccountTagRepository>(); _journalRepository = Substitute.For<IJournalRepository>(); _templateRepository = Substitute.For<ITemplateRepository>(); _fileWriter = new FileWriter(_accountRepository, _accountTagRepository, _templateRepository, _journalRepository); }
public MainWindowViewModel(IAccountRepository accountRepository, IAccountTagRepository accountTagRepository, IJournalRepository journalRepository, ITemplateRepository templateRepository) { _accountTagRepository = accountTagRepository; _accountRepository = accountRepository; _journalRepository = journalRepository; _templateRepository = templateRepository; _accountTagRepository.RepositoryModified += OnRepositoryModified; _accountRepository.RepositoryModified += OnRepositoryModified; _journalRepository.RepositoryModified += OnRepositoryModified; _templateRepository.RepositoryModified += OnRepositoryModified; _fileWriter = new FileWriter(_accountRepository, accountTagRepository, _templateRepository, _journalRepository); _monthlyBreakdownScreenOpener = new ScreenOpener(OpenMonthlyBreakdownScreen); _accountBrowserScreenOpener = new ScreenOpener(OpenAccountBrowserScreen); _accountMaintenanceScreenOpener = new ScreenOpener(OpenAccountMaintenanceScreen); _templateScreenOpener = new ScreenOpener(OpenTemplateScreen); base.DisplayName = "Akcounts"; }
public AccountViewModel(Account account, IAccountRepository accountRepository, IAccountTagRepository accountTagRepository, IMainWindowViewModel mainWindow = null) { if (account == null) throw new ArgumentNullException("account"); if (accountRepository == null) throw new ArgumentNullException("accountRepository"); if (accountTagRepository == null) throw new ArgumentNullException("accountTagRepository"); _mainWindow = mainWindow; _account = account; _accountName = account.Name; _accountRepository = accountRepository; _accountTagRepository = accountTagRepository; _allTransactions = new Collection<TransactionViewModel>(); _visibleTransactions = new ObservableCollection<TransactionViewModel>(); _accountTags = new ObservableCollection<AccountTagViewModel>(); foreach (var tag in account.Tags) { var tagVM = new AccountTagViewModel(tag, _accountTagRepository); tagVM.RequestDelete += RemoveAccountTag; _accountTags.Add(tagVM); } }
public void SetUp() { _mocks = new Mockery(); _mockAccoutTagRepository = _mocks.NewMock<IAccountTagRepository>(); _mockAccoutRepository = _mocks.NewMock<IAccountRepository>(); _mockJournalRepository = _mocks.NewMock<IJournalRepository>(); _mockTemplateRepository = _mocks.NewMock<ITemplateRepository>(); Expect.Once.On(_mockAccoutRepository).EventAdd("RepositoryModified", NMock2.Is.Anything); Expect.Once.On(_mockAccoutTagRepository).EventAdd("RepositoryModified", NMock2.Is.Anything); Expect.Once.On(_mockJournalRepository).EventAdd("RepositoryModified", NMock2.Is.Anything); Expect.Once.On(_mockTemplateRepository).EventAdd("RepositoryModified", NMock2.Is.Anything); _mainWindowViewModel = new MainWindowViewModel(_mockAccoutRepository, _mockAccoutTagRepository, _mockJournalRepository, _mockTemplateRepository); }
public void SetUp() { using (var accountTagStringReader = new StringReader(TestData)) using (XmlReader accountTagXml = new XmlTextReader(accountTagStringReader)) { XElement accountTags = XElement.Load(accountTagXml); _repository = new AccountTagRepository(); } }
public void SetUp() { _mocks = new Mockery(); _mockAccountRepository = _mocks.NewMock<IAccountRepository>(); _mockAccountTagRepository = _mocks.NewMock<IAccountTagRepository>(); _mockMainWindowViewModel = _mocks.NewMock<IMainWindowViewModel>(); _changeCounter = new PropertyChangedCounter(); }
public void SetUp() { _changeCounter = new PropertyChangedCounter(); _mocks = new Mockery(); _mockAccountTagRepository = _mocks.NewMock<IAccountTagRepository>(); _mockAccountRepository = _mocks.NewMock<IAccountRepository>(); ////Expect.Once.On(_mockAccountTagRepository).Method("GetAll").Will(Return.Value(new List<AccountTag>())); var accountList = new List<Account> {_account1, _account2}; Expect.Once.On(_mockAccountRepository).Method("GetAll").Will(Return.Value(accountList)); _accountMaintenenceViewModel = new AccountMaintenenceViewModel(_mockAccountRepository, _mockAccountTagRepository); }
public void SetUp() { _mocks = new Mockery(); _mockAccountTagRepository = _mocks.NewMock<IAccountTagRepository>(); Expect.Exactly(2).On(_mockAccountTagRepository).Method("GetById").With(1).Will(Return.Value(_accountTag1)); Expect.Exactly(2).On(_mockAccountTagRepository).Method("GetById").With(2).Will(Return.Value(_accountTag2)); Expect.Once.On(_mockAccountTagRepository).Method("GetById").With(3).Will(Return.Value(_accountTag3)); Expect.Exactly(2).On(_mockAccountTagRepository).Method("GetById").With(4).Will(Return.Value(_accountTag4)); using (var accountStringReader = new StringReader(TestData)) using (XmlReader accountXml = new XmlTextReader(accountStringReader)) { XElement accounts = XElement.Load(accountXml); _repository = new AccountRepository(_mockAccountTagRepository); } _account6.AddTag(_accountTag3); }