public void EffectiveAtReturnsFalseForAnEntityNotStarted()
        {
            var entity = new EffectiveEntityTestClass(Guid.Empty);

            var startDate = new Date(2019, 12, 01);
            var endDate   = new Date(2019, 12, 31);

            entity.IsEffectiveAt(new Date(2019, 11, 15)).Should().BeFalse();
        }
        public void StartWithValidDate()
        {
            var entity = new EffectiveEntityTestClass(Guid.Empty);

            var startDate = new Date(2019, 12, 01);

            entity.Start(startDate);

            entity.EffectivePeriod.Should().Be(new DateRange(startDate, Date.MaxValue));
        }
        public void EndAnEntityNotStarted()
        {
            var entity = new EffectiveEntityTestClass(Guid.Empty);

            var startDate = new Date(2019, 12, 01);
            var endDate   = new Date(2019, 12, 31);

            Action a = () => entity.End(endDate);

            a.Should().Throw <EffectiveDateException>();
        }
        public void EffectiveDuringForNonOverlappingRange()
        {
            var entity = new EffectiveEntityTestClass(Guid.Empty);

            var startDate = new Date(2019, 12, 01);
            var endDate   = new Date(2019, 12, 31);

            var dateRange = new DateRange(new Date(2018, 01, 01), new Date(2018, 12, 31));

            entity.IsEffectiveDuring(dateRange).Should().BeFalse();
        }
        public void EffectiveAtReturnsTrueForDateInPeriod()
        {
            var entity = new EffectiveEntityTestClass(Guid.Empty);

            var startDate = new Date(2019, 12, 01);
            var endDate   = new Date(2019, 12, 31);

            entity.Start(startDate);
            entity.End(endDate);

            entity.IsEffectiveAt(new Date(2019, 12, 15)).Should().BeTrue();
        }
        public void StartAnAlreadyStartedEntity()
        {
            var entity = new EffectiveEntityTestClass(Guid.Empty);

            var startDate = new Date(2019, 12, 01);

            entity.Start(startDate);

            Action a = () => entity.Start(startDate);

            a.Should().Throw <EffectiveDateException>();
        }