public void RecurringTransactionRepository_Delete()
        {
            var recurringTransactionDataAccessMock = new RecurringTransactionDataAccessMock();
            var repository = new RecurringTransactionRepository(recurringTransactionDataAccessMock);

            var account = new Account
            {
                Name = "TestAccount"
            };

            var transaction = new RecurringTransaction
            {
                ChargedAccount = account,
                Amount = 20,
                AmountWithoutExchange = 20
            };

            repository.Save(transaction);
            Assert.AreSame(transaction, recurringTransactionDataAccessMock.RecurringTransactionTestList[0]);

            repository.Delete(transaction);

            Assert.IsFalse(recurringTransactionDataAccessMock.RecurringTransactionTestList.Any());
            Assert.IsFalse(repository.Data.Any());
        }
Пример #2
0
 private static void CheckIfRecurringWasRemoved(FinancialTransaction transaction)
 {
     if (!transaction.IsRecurring && transaction.ReccuringTransactionId.HasValue)
     {
         RecurringTransactionRepository.Delete(transaction.RecurringTransaction);
         transaction.ReccuringTransactionId = null;
     }
 }
        public void RecurringTransactionRepository_Delete()
        {
            var repository = new RecurringTransactionRepository(_recurringTransactionDataAccessMock);

            var account = new Account {
                Name = "TestAccount"
            };

            var transaction = new RecurringTransaction {
                ChargedAccount        = account,
                Amount                = 20,
                AmountWithoutExchange = 20
            };

            repository.Save(transaction);
            Assert.AreSame(transaction, _recurringTransactionDataAccessMock.RecurringTransactionTestList[0]);

            repository.Delete(transaction);

            Assert.IsFalse(_recurringTransactionDataAccessMock.RecurringTransactionTestList.Any());
            Assert.IsFalse(repository.Data.Any());
        }