public ITransaction Create(Transaction t)
        {
            t.TransactionId = ++_id;
            t.CreatedDate = DateTime.Now;
            t.ModifiedDate = t.CreatedDate;

            _transactions.Add(t.TransactionId, t);
            return t;
        }
        public ITransaction Update(Transaction t)
        {
            t.ModifiedDate = DateTime.Now;
            ITransaction output = null;
            if ( _transactions.TryGetValue(t.TransactionId, out output) )
            {
                Transaction orig = output as Transaction;

                orig.ModifiedDate = DateTime.Now;
                orig.Description = t.Description;
                orig.TransactionAmount = t.TransactionAmount;
                orig.CurrencyCode = t.CurrencyCode;
                orig.Merchant = t.Merchant;
            }
            return output;
        }
        public void TransactionFactoryCreateTest()
        {
            TransactionFactory tf = TransactionFactory.Instance();
            Transaction input = new Transaction();
            input.CurrencyCode = _currency;
            input.Description = _desc;
            input.Merchant = _merchant;
            input.TransactionAmount = _amount;
            input.TransactionDate = _tdate;

            ITransaction output = tf.Create(input);

            Assert.IsNotNull(output);
            Assert.AreEqual(1, output.TransactionId);
            Assert.IsTrue(output.CreatedDate >= _tdate && output.CreatedDate <= DateTime.Now,
                String.Format("CreationDateTest {0} >= {1} <= {2}", output.ModifiedDate, _tdate, DateTime.Now));
            Assert.AreEqual(output.CreatedDate, output.ModifiedDate);
            Assert.AreEqual(_currency, output.CurrencyCode);
            Assert.AreEqual(_merchant, output.Merchant);
            Assert.AreEqual(_desc, output.Description);
            Assert.AreEqual(_amount, output.TransactionAmount);
        }
        public void TransactionFactoryUpdateTest()
        {
            String  currency = "USD";
            String  merchant = "IG Group";
            String  desc = "Test Update";
            Decimal amount = 56.12M;
            DateTime tdate = DateTime.Now;

            TransactionFactory tf = TransactionFactory.Instance();
            ITransaction output = tf.Get (1);

            Transaction input = new Transaction();
            input.TransactionId = output.TransactionId;
            input.CurrencyCode = currency;
            input.Description = desc;
            input.Merchant = merchant;
            input.TransactionAmount = amount;
            input.TransactionDate = output.TransactionDate;

            output = tf.Update(input);

            Assert.IsNotNull(output);
            Assert.IsTrue(output.ModifiedDate >= tdate && output.ModifiedDate <= DateTime.Now,
                String.Format("CreationDateTest {0} >= {1} <= {2}", output.ModifiedDate, tdate, DateTime.Now));
            Assert.IsTrue(output.CreatedDate <= output.ModifiedDate, String.Format("ModifiedDateTest {0} <= {1}", output.CreatedDate, output.ModifiedDate));
            Assert.AreEqual(currency, output.CurrencyCode);
            Assert.AreEqual(merchant, output.Merchant);
            Assert.AreEqual(desc, output.Description);
            Assert.AreEqual(amount, output.TransactionAmount);
        }