public StatementsViewModel(IContext context, IParser[] supportedParsers, IResolveClassificationConflicts resolveConflicts, IMessageBoxService messageBoxService) { _context = context; _operationRepository = context.GetRepository<IRepository<BankOperation>>(); _statementsRepository = context.GetRepository<IRepository<BankStatement>>(); _supportedParsers = supportedParsers.OrderBy(a => a.Name); _importer = new OperationsImporter(_operationRepository, _statementsRepository); _messageBoxService = messageBoxService; _resolveConflicts = resolveConflicts; ApplyRules = true; ChosenParser = SupportedParsers.FirstOrDefault(); ResetListData(); LoadFileCommand = new DelegateCommand(LoadFromFile); LoadRawTextCommand = new DelegateCommand(DoLoadFromRawText, CanLoadFromRawText); DeleteStatementCommand = new DelegateCommand(DeleteSelected, CanDelete); }
public void SetUp() { _operationsRepository = new Mock<IRepository<BankOperation>>(); _statementsRepository = new Mock<IRepository<BankStatement>>(); _statementsRepository.Setup(par => par.Add(It.IsAny<BankStatement>())) .Callback<BankStatement>(st => _insertedStatement = st); _importer = new OperationsImporter(_operationsRepository.Object, _statementsRepository.Object); }