예제 #1
0
        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);
        }
예제 #2
0
        public void CheckDayOffset()
        {
            var cashAccount = new Account(Session)
            {
                Debit = 300, Type = AccountTypeEnum.Cash
            };

            Session.CommitChanges();
            Andrew.DepositAmount(30);
            Session.CommitChanges();
            VideoRentDateTime.AddDays(2);
            Alex.DepositAmount(30);
            Session.CommitChanges();
            VideoRentDateTime.AddDays(2);
            Andrew.DepositAmount(30);
            Session.CommitChanges();
            Assert.IsTrue((VideoRentDateTime.Now - Andrew.LastPayDate()).Days == 4);
            Assert.IsTrue((VideoRentDateTime.Now - Alex.LastPayDate()).Days == 2);
        }