public void Load_FinancialTransaction_DataInitialized() { var accountRepoSetup = new Mock<IDataAccess<Account>>(); accountRepoSetup.Setup(x => x.LoadList(null)).Returns(new List<Account>()); var dataAccessSetup = new Mock<IDataAccess<FinancialTransaction>>(); dataAccessSetup.Setup(x => x.LoadList(null)).Returns(new List<FinancialTransaction> { new FinancialTransaction {Id = 10}, new FinancialTransaction {Id = 15} }); var categoryRepository = new TransactionRepository(dataAccessSetup.Object, new Mock<IDataAccess<RecurringTransaction>>().Object); categoryRepository.Load(); categoryRepository.Data.Any(x => x.Id == 10).ShouldBeTrue(); categoryRepository.Data.Any(x => x.Id == 15).ShouldBeTrue(); }
public void LoadRecurringList_ListWithRecurringTransaction() { var dbHelper = new SqliteConnectionCreator(new WindowsSqliteConnectionFactory()); var transactionDataAccess = new TransactionDataAccess(dbHelper); var recTransactionDataAccess = new RecurringTransactionDataAccess(dbHelper); var repository = new TransactionRepository(transactionDataAccess, recTransactionDataAccess); transactionDataAccess.SaveItem(new FinancialTransaction {Amount = 999, IsRecurring = false}); transactionDataAccess.SaveItem(new FinancialTransaction { Amount = 123, IsRecurring = true, RecurringTransaction = new RecurringTransaction {IsEndless = true} }); repository.Load(); var result = repository.LoadRecurringList().ToList(); result.Count.ShouldBe(1); result.First().Id.ShouldBe(2); result.First().RecurringTransaction.Id.ShouldBe(1); }