Example #1
0
        public void IsOngoing_OneTimes_TrueThenFalse()
        {
            var strategy = new SentinelCloseDateTimeLoopStrategy(new DateTime(2018, 1, 1), new DateTime(2018, 1, 1), new FixedDuration(new TimeSpan(1, 0, 0, 0)));

            Assert.That(strategy.IsOngoing(), Is.True);
            strategy.GetNext();
            Assert.That(strategy.IsOngoing(), Is.False);
        }
Example #2
0
        public void Run_Year_CorrectResult(int stepMonth, int expected)
        {
            var strategy = new SentinelCloseDateTimeLoopStrategy(new DateTime(2018, 1, 1), new DateTime(2019, 4, 10), new YearDuration(stepMonth));
            var final    = DateTime.MinValue;

            while (strategy.IsOngoing())
            {
                final = strategy.GetNext();
            }
            Assert.That(final, Is.EqualTo(new DateTime(expected, 1, 1)));
        }
Example #3
0
        public void Run_day_CorrectResult(int stepDay, int expected)
        {
            var strategy = new SentinelCloseDateTimeLoopStrategy(new DateTime(2018, 1, 1), new DateTime(2018, 1, 5), new FixedDuration(new TimeSpan(stepDay, 0, 0, 0)));
            var final    = new DateTime(2018, 1, 1);

            while (strategy.IsOngoing())
            {
                final = strategy.GetNext();
            }
            Assert.That(final, Is.EqualTo(new DateTime(2018, 1, expected)));
        }
Example #4
0
        public void GetNext_FirstTime_Seed()
        {
            var strategy = new SentinelCloseDateTimeLoopStrategy(new DateTime(2018, 1, 1), new DateTime(2018, 1, 2), new FixedDuration(new TimeSpan(1, 0, 0, 0)));

            Assert.That(strategy.GetNext(), Is.EqualTo(new DateTime(2018, 1, 1)));
        }