Exemple #1
0
        public void IsNotInFuture_When_Argument_Exceeds_Current_DateTime_Should_Throw_ArgumentException()
        {
            _timeProvider.Setup(s => s.Now).Returns(() => _currentDate);

            var ex = Assert.Throws <ArgumentException>(
                () => Invariant.IsNotInFuture(_currentDate.AddTicks(1), PARAMETER_NAME));

            Assert.AreEqual($"Argument '{PARAMETER_NAME}' must not be in the future.", ex.Message);
        }
Exemple #2
0
        public void IsNotInFuture_When_Argument_Is_Earlier_Than_Current_DateTime_Should_Not_Throw()
        {
            _timeProvider.Setup(s => s.Now).Returns(() => _currentDate);

            Assert.DoesNotThrow(() => Invariant.IsNotInFuture(_currentDate.AddTicks(-1), PARAMETER_NAME));
        }