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

            var service = new RentalsService();

            var    payee    = service.FindPayee(1);
            string expected = "Changed Name";

            payee.Name = expected;

            service.SaveUpdatedPayee(payee);

            Assert.AreEqual(expected, service.FindPayee(1).Name);
        }
        public void FindAPayeeThatDoesNotExistReturnsNull()
        {
            DataHelper.NewDb();

            var service = new RentalsService();

            var actual = service.FindPayee(999);

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

            var service = new RentalsService();
            var payee   = service.FindPayee(1);

            payee.Name = "Renter B";

            service.SaveUpdatedPayee(payee);

            Assert.Fail("Added an payee with same name as an exiting payee");
        }
        public void CanFindPayeeById()
        {
            DataHelper.NewDb();

            var service = new RentalsService();

            var actual = service.FindPayee(1);

            var expected = DataHelper.Payees.SingleOrDefault(p => p.Id == 1);

            Assert.AreEqual(expected.Name, actual.Name);
            Assert.AreEqual(expected.DefaultCategoryId, actual.DefaultCategoryId);
            Assert.AreEqual(expected.Memo, actual.Memo);
            Assert.IsNotNull(actual.DefaultCategory);
        }