예제 #1
0
        public void DeleteTransactionTest()
        {
            var factory     = new RegularQuickTransactionFactory();
            var storage     = new MemoryQuickTransactionStorage(factory);
            var transaction = CreateTransaction();

            storage.CreateQuickTransaction(transaction);

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

            storage.DeleteQuickTransaction(transaction);


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


            Assert.AreEqual(0, numberOfTransactions);
            Assert.AreEqual(1, numberOfTransactionsAfterCreate);
        }
예제 #2
0
        public void UpdateTransactionTest()
        {
            var factory     = new RegularQuickTransactionFactory();
            var storage     = new MemoryQuickTransactionStorage(factory);
            var transaction = CreateTransaction();

            storage.CreateQuickTransaction(transaction);
            transaction.Total = 120;


            storage.UpdateQuickTransaction(transaction);
            var storedTransaction = storage.GetAllQuickTransactions().First();


            Assert.AreEqual(transaction.Total, storedTransaction.Total);
        }
예제 #3
0
        public void GetAllTransactionsTest()
        {
            var factory     = new RegularQuickTransactionFactory();
            var storage     = new MemoryQuickTransactionStorage(factory);
            var transaction = CreateTransaction();

            storage.CreateQuickTransaction(transaction);


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


            Assert.AreEqual(transaction.Account, newTransaction.Account);
            Assert.AreEqual(transaction.Category, newTransaction.Category);
            Assert.AreEqual("Simple Transaction", newTransaction.Name);
            Assert.AreEqual(100m, newTransaction.Total);
            Assert.AreEqual(5, newTransaction.Id);
            Assert.AreEqual(0, newTransaction.Weight);
            Assert.AreEqual(false, newTransaction.AskForTotal);
            Assert.AreEqual(false, newTransaction.AskForWeight);
        }