public void ChargeAccounts() { var cashAccount = new Account(Session) { Type = AccountTypeEnum.Cash }; Session.CommitChanges(); Andrew.DepositAmount(30); Session.CommitChanges(); Alex.DepositAmount(30); Session.CommitChanges(); Assert.IsTrue(cashAccount.Balance == -60); VideoRentDateTime.AddMonths(1); Andrew.DebitMembershipFee(30); Session.CommitChanges(); VideoRentDateTime.AddMonths(1); Andrew.DepositAmount(30); Session.CommitChanges(); Andrew.DebitMembershipFee(30); Session.CommitChanges(); VideoRentDateTime.AddMonths(1); Andrew.DebitMembershipFee(30); Session.CommitChanges(); Assert.IsTrue(Andrew.IsMembershipDebter); Assert.IsTrue(GetMonths(VideoRentDateTime.Now - Andrew.LastPayDate()) == 3); Assert.IsFalse(Alex.IsMembershipDebter); Assert.IsTrue(cashAccount.Balance == 0); Assert.IsTrue(Andrew.Accounts[0].Balance == -30); }
public void CheckMemberships() { var acustomer = CreateCustomer(Session, "x", "y"); VideoRentDateTime.AddMonths(1); Session.CommitChanges(); var cashAccount = new CashAccount(Session); acustomer.DepositAmount(15); Session.CommitChanges(); Assert.IsTrue(acustomer.Accounts[0].Balance == 15); VideoRentDateTime.AddMonths(1); Assert.IsTrue(GetMonths(VideoRentDateTime.Now - acustomer.Membership.StartDate) == 2); }