public void ShouldBeValidWhenDateIsNull()
        {
            // Arrange
            var attr = new DateFormatValidationAttribute();
            var date = (object)null;

            // Act
            var isValid = attr.IsValid(date);

            // Assert
            Assert.True(isValid);
        }
        public void ShouldUseDateHelperToValidate()
        {
            // Arrange
            var dateHelperMock = new Mock <DateHelper>(MockBehavior.Strict);
            var attr           = new DateFormatValidationAttribute(dateHelperMock.Object);
            var dateStr        = "2020/10/10";
            var expected       = false;

            dateHelperMock.Setup(i => i.IsValid(dateStr)).Returns(expected);

            // Act
            var actual = attr.IsValid(dateStr);

            // Assert
            Assert.Equal(expected, actual);
            dateHelperMock.Verify(i => i.IsValid(dateStr), Times.Once());
        }