public void SaveAndUpdate_WithRecurringPayment_NoDuplicates()
        {
            var paymentRepository =
                new PaymentRepository(new DatabaseManager(new WindowsSqliteConnectionFactory(),
                                                          new MvxWpfFileStore(FILE_ROOT)));

            var recurringPaymentRepository =
                new RecurringPaymentRepository(new DatabaseManager(new WindowsSqliteConnectionFactory(),
                                                                   new MvxWpfFileStore(FILE_ROOT)));

            var recurringPayment = new Fixture().Create <RecurringPaymentViewModel>();

            recurringPayment.Id = 0;

            recurringPaymentRepository.Save(recurringPayment);
            paymentRepository.ReloadCache();

            var testPayment = new Fixture().Create <PaymentViewModel>();

            testPayment.Id = 0;

            testPayment.RecurringPayment = recurringPayment;

            paymentRepository.Save(testPayment);
            paymentRepository.Save(testPayment);
            var selected = paymentRepository.FindById(testPayment.Id);

            recurringPaymentRepository.GetList(x => x.Note == testPayment.RecurringPayment.Note).Count().ShouldBe(1);
        }
Exemple #2
0
        public void GetList_WithFilter()
        {
            var recurringPaymentRepository =
                new RecurringPaymentRepository(new DatabaseManager(new WindowsSqliteConnectionFactory(),
                                                                   new MvxWpfFileStore(FILE_ROOT)));
            var testRecurringPayment = new Fixture().Create <RecurringPaymentViewModel>();

            testRecurringPayment.Id = 0;

            try
            {
                recurringPaymentRepository.Save(testRecurringPayment);

                recurringPaymentRepository.GetList(x => x.Id == testRecurringPayment.Id).First().Id.ShouldBe(testRecurringPayment.Id);
                recurringPaymentRepository.GetList(x => x.Id == 99).FirstOrDefault().ShouldBeNull();
            }
            finally
            {
                recurringPaymentRepository.Delete(testRecurringPayment);
            }
        }
Exemple #3
0
        public void GetList_WithoutFilter()
        {
            var recurringPaymentRepository =
                new RecurringPaymentRepository(new DatabaseManager(new WindowsSqliteConnectionFactory(),
                                                                   new MvxWpfFileStore(FILE_ROOT)));
            var testRecurringPayment = new Fixture().Create <RecurringPaymentViewModel>();

            testRecurringPayment.Id = 0;

            try
            {
                recurringPaymentRepository.Save(testRecurringPayment);

                var selectedAccount = recurringPaymentRepository.GetList().First();

                selectedAccount.Id.ShouldBe(testRecurringPayment.Id);
                selectedAccount.Amount.ShouldBe(testRecurringPayment.Amount);
            }
            finally
            {
                recurringPaymentRepository.Delete(testRecurringPayment);
            }
        }