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>?)); }
/// <summary> /// 指定采取何种验证方式来验证元素的有效性 /// </summary> /// <param name="validateType"></param> public ValidateAttribute(ValidateTypes validateType) { this.validateType = validateType; }
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>()); }
public ValidateConverter(ValidateTypes validateType) { this.validateType = validateType; }
public ValidateBinding(ValidateTypes validateTypes) : base("Text") { RelativeSource = RelativeSource.Self; Converter = new ValidateConverter(validateTypes); }