Exemplo n.º 1
0
        public void SplitsDateRangeWeekdaysThrowsIfBatchSizeIsGreaterThanFice()
        {
            DateTime start     = new DateTime(2018, 01, 01);
            DateTime end       = new DateTime(2018, 02, 25);
            int      batchSize = 6;

            Assert.Throws <ArgumentOutOfRangeException>(() => DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList());
        }
        public void DateRangeSplitterSplitsFiveHundredYearWeekDayRange()
        {
            DateTime start = new DateTime(2000, 1, 1);
            DateTime end   = start.AddYears(500);

            var range = DateRangeSplitter.SplitDateRangeWeekDays(start, end, 5)
                        .ToList();

            Assert.IsNotEmpty(range);
        }
Exemplo n.º 3
0
        public void SplitsDateRangeWeekdaysSplitsBatchSizeOfFiveIntoExpectedBatches()
        {
            DateTime start     = new DateTime(2018, 10, 29);
            DateTime end       = new DateTime(2018, 11, 27);
            int      batchSize = 5;

            var batches = DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList();

            Assert.AreEqual(5, batches.Count);
        }
Exemplo n.º 4
0
        public void SplitsDateRangeWeekdaysSplitsBatchSizeOfFive()
        {
            DateTime start     = new DateTime(2018, 10, 29);
            DateTime end       = new DateTime(2018, 11, 27);
            int      batchSize = 5;

            var batches = DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList();

            Assert.IsNotNull(batches);
        }
Exemplo n.º 5
0
        public void SplitDateRangeWeekDaysSplitsBatchForBatchSizeOfFourIntoExpectedNumberOfBatches()
        {
            DateTime start     = new DateTime(2018, 10, 29);
            DateTime end       = new DateTime(2018, 11, 27);
            int      batchSize = 4;

            var batches = DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList();

            Assert.IsNotNull(batches);
            Assert.AreEqual(9, batches.Count);
        }
Exemplo n.º 6
0
        public void SplitDateRangeWeekDaysExcludesEndDateIfEndDateIsWeekend()
        {
            DateTime start     = new DateTime(2018, 01, 06);
            DateTime end       = new DateTime(2018, 02, 25);
            int      batchSize = 5;

            var batches = DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList();

            Assert.IsNotNull(batches);
            Assert.AreEqual(7, batches.Count);
            Assert.AreNotEqual(end, batches[batches.Count - 1].Item2);
        }
Exemplo n.º 7
0
        public void SplitsDateRangeWeekdaysReturnsSingleBatchIfRangeIsLessThanBatchSize()
        {
            DateTime start     = new DateTime(2018, 10, 29);
            DateTime end       = new DateTime(2018, 11, 01);
            int      batchSize = 5;

            var batches = DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList();

            Assert.AreEqual(1, batches.Count);
            Assert.AreEqual(new DateTime(2018, 10, 29), batches[0].Item1);
            Assert.AreEqual(new DateTime(2018, 11, 01), batches[0].Item2);
        }
Exemplo n.º 8
0
        public void SplitsDateRangeWeekdaysSplitsBatchSizeOfFiveIntoExpectedFirstBatchIfFirstDayIsSunday()
        {
            DateTime start     = new DateTime(2018, 10, 28);
            DateTime end       = new DateTime(2018, 11, 27);
            int      batchSize = 5;

            var batches = DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList();

            var firstBatch = batches[0];

            Assert.AreEqual(new DateTime(2018, 10, 29), firstBatch.Item1);
            Assert.AreEqual(new DateTime(2018, 11, 02), firstBatch.Item2);
        }
Exemplo n.º 9
0
        public void SplitsDateRangeWeekdaysSplitsBatchSizeOfFiveIntoExpectedLastBatch()
        {
            DateTime start     = new DateTime(2018, 10, 29);
            DateTime end       = new DateTime(2018, 11, 27);
            int      batchSize = 5;

            var batches = DateRangeSplitter.SplitDateRangeWeekDays(start, end, batchSize).ToList();

            var lastBatch = batches[batches.Count - 1];

            Assert.AreEqual(new DateTime(2018, 11, 26), lastBatch.Item1);
            Assert.AreEqual(new DateTime(2018, 11, 27), lastBatch.Item2);
        }