Esempio n. 1
0
        public void ShouldValidateDateIsInFuture(bool expectedIsValid, int secondsToAdd)
        {
            var dateTimeNow = new DateTime(2021, 5, 5);

            var attribute = new DateInFutureAttribute(() => dateTimeNow);

            var isValid = attribute.IsValid(dateTimeNow.AddSeconds(secondsToAdd));

            Assert.That(expectedIsValid, Is.EqualTo(isValid));
        }
        public void ShouldValidateDateIsInTheFuture(bool expectedIsValid, int secondsToAdd)
        {
            var dateTimeNow = new DateTime(2020, 1, 28);

            var attribute = new DateInFutureAttribute(() => dateTimeNow);

            var isValid = attribute.IsValid(dateTimeNow.AddSeconds(secondsToAdd));

            Assert.AreEqual(expectedIsValid, isValid);
        }
Esempio n. 3
0
        public void ShouldHaveExpectedErrorMessage()
        {
            var attribute = new DateInFutureAttribute();

            Assert.That("Date must be in the future", Is.EqualTo(attribute.ErrorMessage));
        }
        public void ShouldHaveExpectedErrorMessage()
        {
            var attribute = new DateInFutureAttribute();

            Assert.AreEqual("Date must be in the future", attribute.ErrorMessage);
        }