Exemplo n.º 1
0
        public void Months()
        {
            // Arrange
            var now = DateTime.Now;

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

            // Act
            run.Every(5).Months();
            var calculated = calculator.Calculate(now);

            // Assert
            Assert.AreEqual(now.AddMonths(5).Month, calculated.Value.Month);
        }
Exemplo n.º 2
0
        public void Weeks()
        {
            // Arrange
            var now = DateTime.Now;

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

            // Act
            run.Every(5).Weeks();
            var calculated = calculator.Calculate(now);

            // Assert
            Assert.AreEqual(now.AddDays(35), calculated.Value);
        }
Exemplo n.º 3
0
        public void On()
        {
            // Arrange
            var calculator = new TimeCalculator();
            var run        = new RunSpecifier(calculator);

            var now         = DateTime.Now;
            var expectedDay = 3;

            // Act
            run.Every(1).Months().On(expectedDay);
            var calculated = calculator.Calculate(now);

            // Assert
            Assert.AreEqual(expectedDay, calculated.Value.Day);
        }
Exemplo n.º 4
0
        public void OnTheFourthDay()
        {
            // Arrange
            var calculator = new TimeCalculator();
            var run        = new RunSpecifier(calculator);

            var now          = new DateTime(2017, 10, 27);
            var expectedDate = new DateTime(2017, 11, 24);

            // Act
            run.Every(1).Months().OnTheFourthDay(DayOfWeek.Friday);
            var calculated = calculator.Calculate(now);

            // Assert
            Assert.AreEqual(DayOfWeek.Friday, calculated.Value.DayOfWeek);
            Assert.AreEqual(expectedDate, calculated.Value.Date);
        }