public void ClientRulesWithCorrectValidationTypeAndErrorMessage()
        {
            // Arrange
            var provider = TestModelMetadataProvider.CreateDefaultProvider();
            var metadata = provider.GetMetadataForProperty(typeof(TypeWithNumericProperty), "Id");
            var adapter = new NumericClientModelValidator();
            var serviceCollection = new ServiceCollection();
            var requestServices = serviceCollection.BuildServiceProvider();
            var context = new ClientModelValidationContext(metadata, provider, requestServices);
            var expectedMessage = "The field DisplayId must be a number.";

            // Act
            var rules = adapter.GetClientValidationRules(context);

            // Assert
            var rule = Assert.Single(rules);
            Assert.Equal("number", rule.ValidationType);
            Assert.Equal(expectedMessage, rule.ErrorMessage);
        }
        public void ClientRulesWithCorrectValidationTypeAndErrorMessage()
        {
            // Arrange
            var provider          = TestModelMetadataProvider.CreateDefaultProvider();
            var metadata          = provider.GetMetadataForProperty(typeof(TypeWithNumericProperty), "Id");
            var adapter           = new NumericClientModelValidator();
            var serviceCollection = new ServiceCollection();
            var requestServices   = serviceCollection.BuildServiceProvider();
            var context           = new ClientModelValidationContext(metadata, provider, requestServices);
            var expectedMessage   = "The field DisplayId must be a number.";

            // Act
            var rules = adapter.GetClientValidationRules(context);

            // Assert
            var rule = Assert.Single(rules);

            Assert.Equal("number", rule.ValidationType);
            Assert.Equal(expectedMessage, rule.ErrorMessage);
        }