Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
0
        public void CreateTransactionTest()
        {
            var factory = new RegularQuickTransactionFactory();
            var storage = new MemoryQuickTransactionStorage(factory);

            var transaction = CreateTransaction();


            var newTransaction = storage.CreateQuickTransaction(transaction);


            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);
        }