Exemplo n.º 1
0
        public void AdjuestPeriodWithStartAndEndNullable()
        {
            DateTime?start = min;
            DateTime?end   = max;

            TimeTool.AdjustPeriod(ref start, ref end);
            end.Should().Be.GreaterThan(start);

            TimeTool.AdjustPeriod(ref end, ref start);
            start.Should().Be.GreaterThan(end);


            start = null;
            end   = max;

            TimeTool.AdjustPeriod(ref start, ref end);
            Assert.IsNull(start);
            end.Should().Be(max);

            start = min;
            end   = null;

            TimeTool.AdjustPeriod(ref start, ref end);
            Assert.IsNull(end);
            start.Should().Be(min);

            start = null;
            end   = null;

            TimeTool.AdjustPeriod(ref start, ref end);
            Assert.IsNull(start);
            Assert.IsNull(end);
        }
Exemplo n.º 2
0
        public void AdjuestPeriodWithStartAndEnd()
        {
            var start = min;
            var end   = max;

            TimeTool.AdjustPeriod(ref start, ref end);
            end.Should().Be.GreaterThan(start);

            TimeTool.AdjustPeriod(ref end, ref start);
            start.Should().Be.GreaterThan(end);
        }
Exemplo n.º 3
0
        public void AdjustPeriodWithDuration()
        {
            var start    = min;
            var duration = DurationUtil.Day;

            TimeTool.AdjustPeriod(ref start, ref duration);
            Assert.AreEqual(min, start);
            Assert.AreEqual(DurationUtil.Day, duration);

            duration = DurationUtil.Day.Negate();

            TimeTool.AdjustPeriod(ref start, ref duration);
            Assert.AreEqual(min.Add(DurationUtil.Day.Negate()), start);
            Assert.AreEqual(DurationUtil.Day, duration);
        }