public void Setting_Validating_Property_To_Invalid_Value_Returns_Failed_ValidationStatus()
        {
            var inpcAccessorPlugin = new InpcPropertyAccessorPlugin();
            var validatorPlugin = new ExceptionValidationPlugin();
            var data = new Data();
            var accessor = inpcAccessorPlugin.Start(new WeakReference(data), nameof(data.MustBePositive), _ => { });
            IValidationStatus status = null;
            var validator = validatorPlugin.Start(new WeakReference(data), nameof(data.MustBePositive), accessor, s => status = s);

            validator.SetValue(-5, BindingPriority.LocalValue);

            Assert.False(status.IsValid);
        }
        public void Setting_Non_Validating_Triggers_Validation()
        {
            var inpcAccessorPlugin = new InpcPropertyAccessorPlugin();
            var validatorPlugin = new ExceptionValidationPlugin();
            var data = new Data();
            var accessor = inpcAccessorPlugin.Start(new WeakReference(data), nameof(data.NonValidated), _ => { });
            IValidationStatus status = null;
            var validator = validatorPlugin.Start(new WeakReference(data), nameof(data.NonValidated), accessor, s => status = s);

            validator.SetValue(5, BindingPriority.LocalValue);

            Assert.NotNull(status);
        }
        public void Produces_BindingNotifications()
        {
            var inpcAccessorPlugin = new InpcPropertyAccessorPlugin();
            var validatorPlugin = new ExceptionValidationPlugin();
            var data = new Data();
            var accessor = inpcAccessorPlugin.Start(new WeakReference(data), nameof(data.MustBePositive));
            var validator = validatorPlugin.Start(new WeakReference(data), nameof(data.MustBePositive), accessor);
            var result = new List<object>();

            validator.Subscribe(x => result.Add(x));
            validator.SetValue(5, BindingPriority.LocalValue);
            validator.SetValue(-2, BindingPriority.LocalValue);
            validator.SetValue(6, BindingPriority.LocalValue);

            Assert.Equal(new[]
            {
                new BindingNotification(0),
                new BindingNotification(5),
                new BindingNotification(new ArgumentOutOfRangeException("value"), BindingErrorType.DataValidationError),
                new BindingNotification(6),
            }, result);
        }