예제 #1
0
        public void GetsOverridenMessageTemplateIfMessageOverrideIsSet()
        {
            ValidatorAttribute attribute = new MockValidatorAttribute(false);

            attribute.MessageTemplate = "overriden";

            Assert.AreEqual("overriden", attribute.GetMessageTemplate());
        }
예제 #2
0
        public void RequestForMessageTemplateWhenOnlyResourceNameIsSetThrows()
        {
            ValidatorAttribute attribute = new MockValidatorAttribute(false);

            attribute.MessageTemplateResourceType = typeof(TestResources);

            attribute.GetMessageTemplate();
        }
예제 #3
0
        public void GetOverridenMessageTemplateFromResourceIfBothResourceNameAndTypeAreSet()
        {
            ValidatorAttribute attribute = new MockValidatorAttribute(false);

            attribute.MessageTemplateResourceName = "overriden";
            attribute.MessageTemplateResourceType = typeof(TestResources);

            Assert.AreEqual("overriden from resource", attribute.GetMessageTemplate());
        }
예제 #4
0
        public void GetsNullMessageTemplateIfNoOverridesAreSet()
        {
            ValidatorAttribute attribute = new MockValidatorAttribute(false);

            Assert.AreEqual(null, attribute.GetMessageTemplate());
        }