private void TestIsValid(int lengthRequired, int lengthToTest, bool valid)
        {
            // Arrange
            var testString = "X".PadRight(lengthToTest);
            var r          = new StringMinimumLengthRule("ARuleName").Property("APropertyName").MinimumLength(lengthRequired);

            // Act
            var result = r.IsValid(new Dictionary <string, string>(1)
            {
                { "APropertyName", testString }
            });

            // Assert
            if (valid)
            {
                Assert.IsTrue(result);
                Assert.IsNull(r.ErrorMessage);
            }
            else
            {
                Assert.IsFalse(result);
                Assert.AreEqual(r.PropertyName + " value is " + lengthToTest.ToString() +
                                " characters, which does not meet the minimum required length of " +
                                lengthRequired.ToString() + " characters.",
                                r.ErrorMessage);
            }
        }
        public void IsValidThrowsExceptionIfMinimumLengthNotSet()
        {
            // Arrange
            var r = new StringMinimumLengthRule("ARuleName").Property("APropertyName");

            // Act
            r.IsValid(new Dictionary <string, string>(1)
            {
                { "APropertyName", "This is also a big string." }
            });
        }
        private void IsValidReturnsTrueIfNullEquivalent(string Value)
        {
            // Arrange
            var r = new StringMinimumLengthRule("ARuleName").Property("APropertyName").MinimumLength(10);

            // Act
            var result = r.IsValid(new Dictionary <string, string>(1)
            {
                { "APropertyName", Value }
            });

            // Assert
            Assert.IsTrue(result);
            Assert.IsNull(r.ErrorMessage);
        }