コード例 #1
0
ファイル: DayUnitTests.cs プロジェクト: thinhils/redesign
        public void EveryWeekday()
        {
            // Arrange
            var sunday   = new DateTime(2018, 02, 18);
            var saturday = new DateTime(2018, 02, 17);

            var monday = new DateTime(2018, 02, 19);

            var calculator = new TimeCalculator();
            var run        = new DayUnit(calculator);

            // Act
            run.Weekday();
            var calculated = calculator.Calculate(sunday);

            // Assert
            var expected = new DateTime(2018, 02, 19);

            Assert.AreEqual(expected, calculated);

            // Act
            calculated = calculator.Calculate(saturday);

            // Assert
            Assert.AreEqual(expected, calculated);

            // Act
            calculated = calculator.Calculate(monday);

            // Assert
            Assert.AreEqual(expected, calculated);
        }
コード例 #2
0
ファイル: Schedule.cs プロジェクト: thinhils/redesign
 private void CalculateNextRun(DateTime last) => NextRun = _calculator.Calculate(last);