Exemplo n.º 1
0
        public void SetUp()
        {
            this.dbConnectionFactory     = new Mock <IDbConnectionFactory>();
            this.categoryGroupRepository = new CategoryGroupRepository(this.dbConnectionFactory.Object);

            this.dbConnectionFactory.Setup(d => d.Create()).Returns(this.databaseHelper.OpenConnection());

            this.databaseHelper.DropAndCreateTable <CategoryGroup>();
            this.databaseHelper.DropAndCreateTable <Category>();
        }
Exemplo n.º 2
0
        public void Initialize(string filename)
        {
            IDatabaseFactory databaseFactory = new DatabaseFactory();
            IUnitOfWork unitOfWork = new UnitOfWork(databaseFactory);
            IAccountRepository accountRepository = new AccountRepository(databaseFactory);
            ITransactionRepository transactionRepository = new TransactionRepository(databaseFactory);
            ICategoryRepository categoryRepository = new CategoryRepository(databaseFactory);
            IVendorRepository vendorRepository = new VendorRepository(databaseFactory);
            ICategoryGroupRepository categoryGroupRepository = new CategoryGroupRepository(databaseFactory);
            IBillRepository billRepository = new BillRepository(databaseFactory);
            IBillTransactionRepository billTransactionRepository = new BillTransactionRepository(databaseFactory);
            IBillGroupRepository billGroupRepository = new BillGroupRepository(databaseFactory);
            IBudgetCategoryRepository budgetCategoryRepository = new BudgetCategoryRepository(databaseFactory);
            IAccountGroupRepository accountGroupRepository = new AccountGroupRepository(databaseFactory);
            IImportDescriptionVendorMapRepository importDescriptionVendorMapRepository = new ImportDescriptionVendorMapRepository(databaseFactory);
            IAccountService accountService = new AccountService(unitOfWork, accountRepository, transactionRepository, categoryRepository, vendorRepository, billRepository, billTransactionRepository, billGroupRepository, categoryGroupRepository, budgetCategoryRepository, importDescriptionVendorMapRepository);
            TransactionImporter importer = new TransactionImporter(unitOfWork, accountService, accountRepository, transactionRepository, vendorRepository, categoryGroupRepository, accountGroupRepository, importDescriptionVendorMapRepository);

            importer.Import(filename);
        }
Exemplo n.º 3
0
 public void WhenDbConnectionFactoryIsNullThenThrowArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => this.categoryGroupRepository = new CategoryGroupRepository(null));
 }