public void NoImplementation(ValidateTypes sut)
 {
     sut.Registrations.Items.Returns(new Dictionary <Type, IReadOnlyList <Registration> >()
     {
         { typeof(string), new List <Registration>() }
     });
     Assert.Throws <AutofacValidationException>(() =>
     {
         sut.Validate(typeof(string).AsEnumerable());
     });
 }
 public void TypicalValidate(ValidateTypes sut)
 {
     sut.Registrations.Items.Returns(new Dictionary <Type, IReadOnlyList <Registration> >()
     {
         { typeof(string), new List <Registration>()
           {
               new Registration(typeof(int), false)
           } }
     });
     sut.Validate(typeof(string).AsEnumerable());
     sut.TypeCtor.Received(1).Validate(typeof(int), default(HashSet <string>?));
 }
Example #3
0
 /// <summary>
 /// 指定采取何种验证方式来验证元素的有效性
 /// </summary>
 /// <param name="validateType"></param>
 public ValidateAttribute(ValidateTypes validateType)
 {
     this.validateType = validateType;
 }
Example #4
0
 private void InternalValidate(IEnumerable <Type> types)
 {
     ReferenceChecker.Check();
     ValidateTypes.Validate(types);
 }
 public void Empty(ValidateTypes sut)
 {
     sut.Registrations.Items.Returns(new Dictionary <Type, IReadOnlyList <Registration> >());
     sut.Validate(Enumerable.Empty <Type>());
 }
Example #6
0
 public ValidateConverter(ValidateTypes validateType)
 {
     this.validateType = validateType;
 }
Example #7
0
 public ValidateBinding(ValidateTypes validateTypes) : base("Text")
 {
     RelativeSource = RelativeSource.Self;
     Converter      = new ValidateConverter(validateTypes);
 }