Пример #1
0
        public void GetErrorMessage_StringLength()
        {
            adapter.Attribute.MinimumLength = 0;

            String expected = String.Format(Validations.StringLength, "StringLength", 128);
            String actual   = adapter.GetErrorMessage(context);

            Assert.Equal(Validations.StringLength, adapter.Attribute.ErrorMessage);
            Assert.Equal(expected, actual);
        }
Пример #2
0
        public void GetErrorMessage_StringLength()
        {
            adapter.Attribute.MinimumLength = 0;

            String expected = Validation.For("StringLength", context.ModelMetadata.PropertyName, 128);
            String actual   = adapter.GetErrorMessage(context);

            Assert.Equal(Validation.For("StringLength"), adapter.Attribute.ErrorMessage);
            Assert.Equal(expected, actual);
        }
        public void GetErrorMessage_StringLengthRange()
        {
            StringLengthAdapter adapter = new StringLengthAdapter(new StringLengthAttribute(128)
            {
                MinimumLength = 4
            });

            String expected = Validation.For("StringLengthRange", context.ModelMetadata.PropertyName, 128, 4);
            String actual   = adapter.GetErrorMessage(context);

            Assert.Equal(Validation.For("StringLengthRange"), adapter.Attribute.ErrorMessage);
            Assert.Equal(expected, actual);
        }