예제 #1
0
        public void IsSingleChain_Not_Allowed_When_There_Are_No_Ranges()
        {
            var    collection = new DateRangeCollection();
            Action action     = () => collection.IsSingleChain();

            action.Should().Throw <InvalidOperationException>();
        }
예제 #2
0
        public void Chain_With_Unbounded_Ranges_Creates_Always_Single_Chain()
        {
            var collection = new DateRangeCollection
            {
                new DateRange(null, new DateTime(2017, 12, 31)),
                new DateRange(new DateTime(2018, 1, 1), null),
            };

            collection.IsSingleChain().Should().BeTrue();
            collection.GetSingleChain().Should().Be(DateRange.Always);
        }
예제 #3
0
        public void IsChain_With_Non_Adjacent_Ranges_Should_Be_False()
        {
            var collection = new DateRangeCollection
            {
                DateRange.Year(2016),
                DateRange.Year(2018),
                DateRange.Year(2019),
            };

            collection.IsSingleChain().Should().BeFalse();
            collection.GetSingleChain().IsEmpty.Should().BeTrue();
        }
예제 #4
0
        public void IsChain_With_Adjacent_Ranges_Should_Be_True()
        {
            var collection = new DateRangeCollection
            {
                DateRange.Year(2016),
                DateRange.Year(2018),
                DateRange.Year(2017),
            };

            collection.IsSingleChain().Should().BeTrue();
            collection.GetSingleChain().Should().Be(DateRange.Years(2016, 3));
        }