protected override void Context()
        {
            _source       = A.Fake <IAnInterface>();
            _screenBinder = A.Fake <ScreenBinder <IAnInterface> >();

            _elementToValidate = A.Fake <IElementBinder <IAnInterface, string> >();
            A.CallTo(() => _elementToValidate.Source).Returns(_source);
            A.CallTo(() => _elementToValidate.PropertyName).Returns("FirstName");
            A.CallTo(() => _elementToValidate.GetValueFromControl()).Returns("Toto");
            _elementToValidate.ParentBinder = _screenBinder;

            _validationEngine = A.Fake <IValidationEngine>();
            sut = new ElementBinderValidator <IAnInterface, string>(_validationEngine);
        }
コード例 #2
0
 public INotification GetValidationNotification(IElementBinder <TObject, TPropertyType> elementToValidate)
 {
     try
     {
         return(_validationEngine.Validate(elementToValidate.Source, elementToValidate.PropertyName, elementToValidate.GetValueFromControl()));
     }
     catch (Exception e)
     {
         return(new Notification(e.Message));
     }
 }