Esempio n. 1
0
 public void Setup()
 {
     this.validatedElement =
         new ValidationAttributeValidatedElement(
             StaticReflection.GetFieldInfo((TypeWithValidationAttributes t)
                                           => t.FieldWithMultipleValidationAttributes));
 }
Esempio n. 2
0
        public void ThenValidatedFieldsContainTheExpectedDescriptors()
        {
            var validatedFields = this.validatedType.GetValidatedFields();

            Assert.AreEqual(
                0,
                validatedFields
                .Where(vf => vf.MemberInfo ==
                       StaticReflection.GetFieldInfo(
                           (TypeWithValidationAttributes t) => t.FieldWithNoValidationAttributes))
                .First()
                .GetValidatorDescriptors()
                .Count());

            Assert.AreEqual(
                1,
                validatedFields
                .Where(vf => vf.MemberInfo ==
                       StaticReflection.GetFieldInfo(
                           (TypeWithValidationAttributes t) => t.FieldWithMultipleValidationAttributes))
                .First()
                .GetValidatorDescriptors()
                .Count());
        }
Esempio n. 3
0
 public void ThenReturnsConfiguredMember()
 {
     Assert.AreSame(
         StaticReflection.GetFieldInfo((TypeWithValidationAttributes t) => t.FieldWithMultipleValidationAttributes),
         this.validatedElement.MemberInfo);
 }