Ejemplo n.º 1
0
        public void DeleteComplexTransactionTest()
        {
            ITransactionFactory transactionFactory = new RegularTransactionFactory();
            var accountStorage  = new SqLiteAccountStorage(new RegularAccountFactory());
            var categoryStorage = new SqLiteCategoryStorage(new RegularCategoryFactory());
            var storage         = new SqLiteTransactionStorage(transactionFactory, accountStorage, categoryStorage);

            categoryStorage.DeleteAllData();
            accountStorage.DeleteAllData();
            storage.DeleteAllData();
            var transaction       = CreateTransaction(accountStorage, categoryStorage, transactionFactory);
            var childTransaction  = CreateTransaction(accountStorage, categoryStorage, transactionFactory);
            var childTransaction1 = CreateTransaction(accountStorage, categoryStorage, transactionFactory);
            var newTransaction    = storage.CreateTransaction(transaction);

            storage.AddChildTransaction(newTransaction, storage.CreateTransaction(childTransaction));
            storage.AddChildTransaction(newTransaction, storage.CreateTransaction(childTransaction1));



            storage.DeleteTransaction(newTransaction);


            var numberOfTransactions = storage.GetAllTransactions().Count();


            Assert.AreEqual(0, numberOfTransactions);
        }
Ejemplo n.º 2
0
        public void DeleteTransactionTest()
        {
            var accountFactory     = new RegularAccountFactory();
            var categoryFactory    = new RegularCategoryFactory();
            var accountStorage     = new SqLiteAccountStorage(accountFactory);
            var categoryStorage    = new SqLiteCategoryStorage(categoryFactory);
            var transactionFactory = new RegularTransactionFactory();
            var storage            = new SqLiteTransactionStorage(transactionFactory, accountStorage, categoryStorage);

            storage.DeleteAllData();
            var transaction = CreateTransaction();

            storage.CreateTransaction(transaction);



            storage.DeleteTransaction(transaction);


            var numberOfTransactions = storage.GetAllTransactions().Count();


            Assert.AreEqual(0, numberOfTransactions);
        }