public void ClientRulesWithCompareAttribute_ErrorMessageUsesResourceOverride()
        {
            if (TestPlatformHelper.IsMono)
            {
                // ValidationAttribute in Mono does not read non-public resx properties.
                return;
            }

            // Arrange
            var metadataProvider = new DataAnnotationsModelMetadataProvider();
            var metadata         = metadataProvider.GetMetadataForProperty(() => null, typeof(PropertyNameModel), "MyProperty");
            var attribute        = new CompareAttribute("OtherProperty")
            {
                ErrorMessageResourceName = "CompareAttributeTestResource",
                ErrorMessageResourceType = typeof(Test.Resources),
            };
            var context = new ClientModelValidationContext(metadata, metadataProvider);
            var adapter = new CompareAttributeAdapter(attribute);

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

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

            Assert.Equal("Comparing MyProperty to OtherProperty.", rule.ErrorMessage);
        }
        public void ClientRulesWithCompareAttribute_ErrorMessageUsesPropertyName()
        {
            // Arrange
            var metadataProvider = new DataAnnotationsModelMetadataProvider();
            var metadata         = metadataProvider.GetMetadataForProperty(() => null, typeof(PropertyNameModel), "MyProperty");
            var attribute        = new CompareAttribute("OtherProperty");
            var context          = new ClientModelValidationContext(metadata, metadataProvider);
            var adapter          = new CompareAttributeAdapter(attribute);

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

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

            Assert.Equal("'MyProperty' and 'OtherProperty' do not match.", rule.ErrorMessage);
        }