public void CanUpdateTransaction()
        {
            DataHelper.NewDb();

            var service = new RentalsService();

            var      transaction = service.FindTransaction(1);
            DateTime expected    = DateTime.Today;

            transaction.Date = expected;

            service.SaveUpdatedTransaction(transaction);

            Assert.AreEqual(expected, service.FindTransaction(1).Date);
        }
        public void FindATransactionThatDoesNotExistReturnsNull()
        {
            DataHelper.NewDb();

            var service = new RentalsService();

            var actual = service.FindTransaction(999);

            Assert.IsNull(actual);
        }
        public void CannotUpdateATransactionToHaveAnAmountOfZero()
        {
            DataHelper.NewDb();

            var service     = new RentalsService();
            var transaction = service.FindTransaction(1);

            transaction.Amount = 0.00m;

            service.SaveUpdatedTransaction(transaction);

            Assert.Fail("Added an transaction with an amount of zero");
        }
        public void CanFindTransactionById()
        {
            DataHelper.NewDb();

            var service = new RentalsService();

            var actual = service.FindTransaction(1);

            var expected = DataHelper.Transactions.SingleOrDefault(t => t.Id == 1);

            Assert.AreEqual(expected.Date, actual.Date);
            Assert.AreEqual(expected.Amount, actual.Amount);
            Assert.AreEqual(expected.AccountId, actual.AccountId);
            Assert.AreEqual(expected.PayeeId, actual.PayeeId);
            Assert.AreEqual(expected.CategoryId, actual.CategoryId);
            Assert.AreEqual(expected.Reference, actual.Reference);
            Assert.AreEqual(expected.Memo, actual.Memo);
        }