public void ValidationAttributeExtensionsResolveErrorMessageExceptionTest()
        {
            var attribute = new MaxLengthAttribute(10)
            {
                ErrorMessageResourceType = typeof(string),
                ErrorMessageResourceName = "MaxLengthErrorMessage"
            };

            attribute.ResolveErrorMessage();
        }
        public void ValidationAttributeExtensionsResolveErrorMessageTest()
        {
            // arrange
            var expectedResourceMessage = TestResources.MaxLengthErrorMessage;
            var expectedStaticMessage   = "Foo";
            var attribute = new MaxLengthAttribute(10)
            {
                ErrorMessageResourceType = typeof(TestResources),
                ErrorMessageResourceName = "MaxLengthErrorMessage"
            };
            // act && assert
            var currentMessage = attribute.ResolveErrorMessage();

            Assert.AreEqual(expectedResourceMessage, currentMessage, "Expected error message does not match when resource is used.");
            attribute.ErrorMessage = expectedStaticMessage;
            currentMessage         = attribute.ResolveErrorMessage();
            Assert.AreEqual(expectedStaticMessage, currentMessage, "Expected error message does not match when direct message is used.");
            attribute = new MaxLengthAttribute(10);
            Assert.IsNull(attribute.ResolveErrorMessage(), "Result error message is not null.");
        }