Inheritance: System.Condition
        public ConditionalOnAutomation WithOnAtNightRange()
        {
            var nightCondition = new TimeRangeCondition(_dateTimeService).WithStart(_daylightService.Sunset).WithEnd(_daylightService.Sunrise);
            WithCondition(ConditionRelation.And, nightCondition);

            return this;
        }
        public void NightRange_IN_RANGE_ShouldBeFulfilled()
        {
            var dateTimeService = new TestDateTimeService();
            dateTimeService.SetTime(TimeSpan.Parse("21:00"));

            var condition = new TimeRangeCondition(dateTimeService)
                .WithStart(TimeSpan.Parse("18:00"))
                .WithEnd(TimeSpan.Parse("08:00"));

            condition.Validate().ShouldBeEquivalentTo(ConditionState.Fulfilled);
        }
        public void AdjustedRange_OUT_OF_RANGE_ShouldBeNotFulfilled()
        {
            var dateTimeService = new TestDateTimeService();
            dateTimeService.SetTime(TimeSpan.Parse("15:00"));

            // 10-18 adjusted to 16-18
            var condition = new TimeRangeCondition(dateTimeService)
                .WithStart(TimeSpan.Parse("10:00"))
                .WithEnd(TimeSpan.Parse("18:00"))
                .WithStartAdjustment(TimeSpan.FromHours(6));

            condition.Validate().ShouldBeEquivalentTo(ConditionState.NotFulfilled);
        }