public void GetUnclearedPayments_AccountNull() { var accountRepositorySetup = new Mock<IAccountRepository>(); accountRepositorySetup.SetupGet(x => x.Data).Returns(new ObservableCollection<Account>()); var categoryDataAccessSetup = new Mock<IRepository<Category>>(); categoryDataAccessSetup.SetupGet(x => x.Data).Returns(new ObservableCollection<Category>()); var repository = new PaymentRepository(new PaymentDataAccessMock(), new RecurringPaymentDataAccessMock(), accountRepositorySetup.Object, categoryDataAccessSetup.Object); repository.Data.Add(new Payment { Amount = 55, Date = DateTime.Today.AddDays(-1), Note = "this is a note!!!", IsCleared = false } ); var payments = repository.GetUnclearedPayments(); Assert.AreEqual(1, payments.Count()); }
public void GetUnclearedPayments_FutureDate_PastPayments() { var accountRepositorySetup = new Mock<IAccountRepository>(); accountRepositorySetup.SetupGet(x => x.Data).Returns(new ObservableCollection<Account>()); var categoryDataAccessSetup = new Mock<IRepository<Category>>(); categoryDataAccessSetup.SetupGet(x => x.Data).Returns(new ObservableCollection<Category>()); var repository = new PaymentRepository(new PaymentDataAccessMock(), new RecurringPaymentDataAccessMock(), accountRepositorySetup.Object, categoryDataAccessSetup.Object); var account = new Account { Id = 2, Name = "TestAccount" }; repository.Save(new Payment { ChargedAccount = account, Amount = 55, Date = Utilities.GetEndOfMonth().AddDays(-1), Note = "this is a note!!!", IsCleared = false } ); var payments = repository.GetUnclearedPayments(); Assert.AreEqual(0, payments.Count()); payments = repository.GetUnclearedPayments(Utilities.GetEndOfMonth()); Assert.AreEqual(1, payments.Count()); }