public void IsValidReturnsFalseIfCnpjIsInvalidAndStrict()
        {
            var attr = new PunctuatedCnpjAttribute("The CNPJ is invalid");

            var actual = attr.IsValid(strictInvalidCnpj);

            Assert.IsFalse(actual);
        }
        public void IsValidReturnsTrueIfCnpjIsValidAndStrict()
        {
            var attr = new PunctuatedCnpjAttribute("The CNPJ is invalid");

            var actual = attr.IsValid("63.943.315/0001-92");

            Assert.IsTrue(actual);
        }
        public void IsValidReturnsFalseIfCnpjIsInvalidAndLoose()
        {
            var attr = new PunctuatedCnpjAttribute();

            var actual = attr.IsValid("32343315/000134");

            Assert.IsFalse(actual);
        }
        public void ErrorMessageReturnsTheUserDefinedErrorMessage()
        {
            var attr = new PunctuatedCnpjAttribute("Error Message");

            var expected = "Error Message";

            var actual = attr.FormatErrorMessage(string.Empty);

            Assert.AreEqual <string>(expected, actual);
        }
        public void ErrorMessageReturnsDefaultErrorMessage()
        {
            var expected = "O CNPJ é inválido";

            var attr = new PunctuatedCnpjAttribute();

            var actual = attr.FormatErrorMessage(string.Empty);

            Assert.AreEqual <string>(expected, actual);
        }
        public void GetClientValidationRulesReturnsValidationTypeConsistingOnlyOfLowercaseLetters()
        {
            Mock <ModelMetadataProvider> provider = new Mock <ModelMetadataProvider>();
            Mock <ModelMetadata>         metadata = new Mock <ModelMetadata>(provider.Object, null, null, typeof(string), null);

            var attr     = new PunctuatedCnpjAttribute();
            var expected = "cnpj";

            foreach (var validationRule in attr.GetClientValidationRules(metadata.Object, null))
            {
                Assert.AreEqual <string>(expected, validationRule.ValidationType);
            }
        }