Example #1
0
        public void Should_return_daily_lease_duration()
        {
            DateTime yesterday = DateTime.Now.AddDays(-1);
            DateTime today     = DateTime.Now;

            ILeaseDuration duration = LeaseDurations.FindFor(yesterday, today);

            Assert.AreEqual(LeaseDurations.Daily, duration);
        }
Example #2
0
        public void Should_return_monthly_lease_duration()
        {
            DateTime aMonthAgo = DateTime.Now.AddDays(-30);
            DateTime today     = DateTime.Now;

            ILeaseDuration duration = LeaseDurations.FindFor(aMonthAgo, today);

            Assert.AreEqual(LeaseDurations.Monthly, duration);
        }
Example #3
0
        public void Should_return_yearly_lease_duration()
        {
            DateTime aYearAgo = DateTime.Now.AddDays(-365);
            DateTime today    = DateTime.Now;

            ILeaseDuration duration = LeaseDurations.FindFor(aYearAgo, today);

            Assert.AreEqual(LeaseDurations.Yearly, duration);
        }
Example #4
0
        public void Should_return_weekly_lease_duration()
        {
            DateTime aWeekAgo = DateTime.Now.AddDays(-7).Date;
            DateTime today    = DateTime.Now.Date;

            ILeaseDuration duration = LeaseDurations.FindFor(aWeekAgo, today);

            Assert.AreEqual(LeaseDurations.Weekly, duration);
        }
Example #5
0
 public IEnumerable <ISlipLease> AllLeasesFor(long customerId)
 {
     foreach (IDatabaseRow row in _gateway.FindAllRowsMatching(Queries.SelectLeasesFor(customerId)))
     {
         yield return
             (new SlipLease(
                  _slipMapper.FindBy(row.From <long>(LeaseTable.SlipID)),
                  LeaseDurations.FindFor(row.From <DateTime>(LeaseTable.StartDate), row.From <DateTime>(LeaseTable.EndDate)),
                  row.From <DateTime>(LeaseTable.StartDate),
                  row.From <DateTime>(LeaseTable.EndDate)
                  ));
     }
 }