예제 #1
0
        public void Save_ExistingEntryUpdated()
        {
            var recPaymentRepository =
                new RecurringPaymentRepository(new DatabaseManager(new WindowsSqliteConnectionFactory(),
                                                                   new MvxWpfFileStore(FILE_ROOT)));
            var testRecurringPayment = new Fixture().Create <RecurringPaymentViewModel>();

            testRecurringPayment.Id = 0;

            try
            {
                recPaymentRepository.Save(testRecurringPayment);
                recPaymentRepository.FindById(testRecurringPayment.Id).ShouldNotBeNull();

                const string updatedNote = "FOOOOOOOOOO";
                testRecurringPayment.Note = updatedNote;

                recPaymentRepository.Save(testRecurringPayment);
                recPaymentRepository.FindById(testRecurringPayment.Id).Note.ShouldBe(updatedNote);
            }
            finally
            {
                recPaymentRepository.Delete(testRecurringPayment);
            }
        }
예제 #2
0
        public void Delete_PaymentDeleted()
        {
            var recurringPaymentRepository =
                new RecurringPaymentRepository(new DatabaseManager(new WindowsSqliteConnectionFactory(),
                                                                   new MvxWpfFileStore(FILE_ROOT)));
            var testRecurringPayment = new Fixture().Create <RecurringPaymentViewModel>();

            testRecurringPayment.Id = 0;

            recurringPaymentRepository.Save(testRecurringPayment);
            recurringPaymentRepository.FindById(testRecurringPayment.Id).ShouldNotBeNull();

            recurringPaymentRepository.Delete(testRecurringPayment);
            recurringPaymentRepository.FindById(testRecurringPayment.Id).ShouldBeNull();
        }