Example #1
0
        public void NowAndEvery()
        {
            // Arrange
            var now = DateTime.Now;

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

            // Act
            run.Now().AndEvery(10).Seconds();
            var calculated = calculator.Calculate(now);

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

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

            // Assert
            Assert.AreEqual(now.AddSeconds(10), calculated);
        }
Example #2
0
        public void Now()
        {
            // Arrange
            var now = DateTime.Now;

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

            // Act
            run.Now();
            var calculated = calculator.Calculate(now);

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

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

            // Assert
            Assert.AreEqual(null, calculated);
        }