コード例 #1
0
        public void SpecialCheck()
        {
            IDateService date = CreateDateService();
            var          repo = CreateRepo(
                new BookingEntity {
                From = DateTimeHour(9), To = DateTimeHour(11), Code = "1", Status = BookingStatusEnum.Paid
            },
                new BookingEntity {
                From = DateTimeHour(-30), To = DateTimeHour(30), Code = "2", Status = BookingStatusEnum.Special
            });
            var check = new CheckService(repo, date);

            Assert.IsTrue(check.Check(0, "1"));
            Assert.IsTrue(check.Check(0, "2"));
        }
コード例 #2
0
        public void CheckExcludingNonPaidAndNonSpecial()
        {
            IDateService date = CreateDateService();
            IRepository <BookingEntity> repo = CreateRepo(
                new BookingEntity {
                From = DateTimeHour(9), To = DateTimeHour(11), Code = "1", Status = BookingStatusEnum.None
            },
                new BookingEntity {
                From = DateTimeHour(-30), To = DateTimeHour(30), Code = "2", Status = BookingStatusEnum.Unpaid
            },
                new BookingEntity {
                From = DateTimeHour(-30), To = DateTimeHour(30), Code = "3", Status = BookingStatusEnum.Canceled
            });
            var check = new CheckService(repo, date);

            Assert.IsFalse(check.Check(0, "1"));
            Assert.IsFalse(check.Check(0, "2"));
            Assert.IsFalse(check.Check(0, "3"));
        }
コード例 #3
0
        public void WrongCodeCheck()
        {
            IDateService date = CreateDateService();
            var          repo = CreateRepo(new BookingEntity {
                From = DateTimeHour(9), To = DateTimeHour(11), Code = "2", Status = BookingStatusEnum.Paid
            });
            var check = new CheckService(repo, date);

            bool result = check.Check(0, "1");

            Assert.IsFalse(result);
        }
コード例 #4
0
        public void EqualOneHourCheck()
        {
            IDateService date = CreateDateService();
            var          repo = CreateRepo(new BookingEntity {
                From = DateTimeHour(10), To = DateTimeHour(10), Code = "1", Status = BookingStatusEnum.Paid
            });
            var check = new CheckService(repo, date);

            bool result = check.Check(0, "1");

            Assert.IsTrue(result);
        }