public void ValidatesValidRegexTest()
        {
            var validator = new IsARegexValidationRule();

            validator.MinimumGroupsInRegex = 0;

            var validationResult = validator.Validate("[A-Z]", CultureInfo.CurrentCulture);

            Assert.IsTrue(validationResult.IsValid);
        }
        public void InValidatesIncorrectRegexTest()
        {
            var validator = new IsARegexValidationRule();

            validator.ErrorMessage         = ErrorMessage;
            validator.MinimumGroupsInRegex = 0;

            var validationResult = validator.Validate("[A-Z", CultureInfo.CurrentCulture);

            Assert.IsFalse(validationResult.IsValid);
            Assert.AreEqual(ErrorMessage, validationResult.ErrorContent.ToString());
        }
        public void InValidatesCorrectRegexButWithLessThanMinumumGroupsTest()
        {
            var validator = new IsARegexValidationRule();

            validator.ErrorMessage = ErrorMessage;

            validator.MinimumGroupsInRegex = 2;
            var validationResult = validator.Validate("(.*)-(.*)", CultureInfo.CurrentCulture);

            Assert.IsTrue(validationResult.IsValid);

            validator.MinimumGroupsInRegex = 30;
            validationResult = validator.Validate("(.*)-(.*)", CultureInfo.CurrentCulture);
            Assert.IsFalse(validationResult.IsValid);
        }