示例#1
0
        public void UpdateTransactionTest()
        {
            var accountFactory     = new RegularAccountFactory();
            var categoryFactory    = new RegularCategoryFactory();
            var accountStorage     = new SqLiteAccountStorage(accountFactory);
            var categoryStorage    = new SqLiteCategoryStorage(categoryFactory);
            var transactionFactory = new RegularQuickTransactionFactory();
            var storage            = new SqLiteQuickTransactionStorage(transactionFactory, accountStorage, categoryStorage);

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

            storage.CreateQuickTransaction(transaction);

            transaction.Name  = "New Name";
            transaction.Total = 515.03m;


            storage.UpdateQuickTransaction(transaction);


            var firstTransaction = storage.GetAllQuickTransactions().First();

            Assert.AreEqual(transaction.Name, firstTransaction.Name);
            Assert.AreEqual(transaction.Category.Id, firstTransaction.Category.Id);
            Assert.AreEqual(transaction.Account.Id, firstTransaction.Account.Id);
            Assert.AreEqual(transaction.Total, firstTransaction.Total);
        }
示例#2
0
        public void CreateTransactionTest()
        {
            var accountFactory     = new RegularAccountFactory();
            var categoryFactory    = new RegularCategoryFactory();
            var accountStorage     = new SqLiteAccountStorage(accountFactory);
            var categoryStorage    = new SqLiteCategoryStorage(categoryFactory);
            var transactionFactory = new RegularQuickTransactionFactory();
            var storage            = new SqLiteQuickTransactionStorage(transactionFactory, accountStorage, categoryStorage);
            var transaction        = CreateTransaction();


            var newTransaction = storage.CreateQuickTransaction(transaction);


            Assert.AreEqual(transaction.Name, newTransaction.Name);
            Assert.AreEqual(transaction.Category.Id, newTransaction.Category.Id);
            Assert.AreEqual(transaction.Account.Id, newTransaction.Account.Id);
            Assert.AreEqual(transaction.Total, newTransaction.Total);
        }
示例#3
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 RegularQuickTransactionFactory();
            var storage            = new SqLiteQuickTransactionStorage(transactionFactory, accountStorage, categoryStorage);

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

            storage.CreateQuickTransaction(transaction);



            storage.DeleteQuickTransaction(transaction);


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


            Assert.AreEqual(0, numberOfTransactions);
        }