public void ClientRule()
        {
            // Arrange
            var attribute = new EmailAddressAttribute();
            var provider  = new Mock <ModelMetadataProvider>();
            var metadata  = new ModelMetadata(
                provider.Object,
                null,
                null,
                typeof(string),
                "PropertyName"
                );

            // Act
            ModelClientValidationRule clientRule = attribute
                                                   .GetClientValidationRules(metadata, null)
                                                   .Single();

            // Assert
            Assert.Equal("email", clientRule.ValidationType);
            Assert.Equal(
                "The PropertyName field is not a valid e-mail address.",
                clientRule.ErrorMessage
                );
            Assert.Empty(clientRule.ValidationParameters);
        }
        public void ClientRule() {
            // Arrange
            var attribute = new EmailAddressAttribute();
            var provider = new Mock<ModelMetadataProvider>();
            var metadata = new ModelMetadata(provider.Object, null, null, typeof(string), "PropertyName");

            // Act
            ModelClientValidationRule clientRule = attribute.GetClientValidationRules(metadata, null).Single();

            // Assert
            Assert.AreEqual("email", clientRule.ValidationType);
            Assert.AreEqual("The PropertyName field is not a valid e-mail address.", clientRule.ErrorMessage);
            Assert.AreEqual(0, clientRule.ValidationParameters.Count);
        }