public void DataValidationError_With_FallbackValue_Causes_Target_Update()
        {
            var target = new Class1();
            var source = new Subject <BindingValue <string> >();

            target.Bind(Class1.FooProperty, source);
            source.OnNext("initial");
            source.OnNext(BindingValue <string> .DataValidationError(new InvalidOperationException("Foo"), "bar"));

            Assert.Equal("bar", target.GetValue(Class1.FooProperty));
        }
        public void Binding_Non_Validated_Direct_Property_Does_Not_Call_UpdateDataValidation()
        {
            var target = new Class1();
            var source = new Subject <BindingValue <int> >();

            target.Bind(Class1.NonValidatedDirectProperty, source);
            source.OnNext(6);
            source.OnNext(BindingValue <int> .BindingError(new Exception()));
            source.OnNext(BindingValue <int> .DataValidationError(new Exception()));
            source.OnNext(6);

            Assert.Empty(target.Notifications);
        }
        public void Binding_Validated_Direct_Property_Calls_UpdateDataValidation()
        {
            var target = new Class1();
            var source = new Subject <BindingValue <int> >();

            target.Bind(Class1.ValidatedDirectIntProperty, source);
            source.OnNext(6);
            source.OnNext(BindingValue <int> .BindingError(new Exception()));
            source.OnNext(BindingValue <int> .DataValidationError(new Exception()));
            source.OnNext(7);

            var result = target.Notifications;

            Assert.Equal(4, result.Count);
            Assert.Equal(BindingValueType.Value, result[0].type);
            Assert.Equal(6, result[0].value);
            Assert.Equal(BindingValueType.BindingError, result[1].type);
            Assert.Equal(BindingValueType.DataValidationError, result[2].type);
            Assert.Equal(BindingValueType.Value, result[3].type);
            Assert.Equal(7, result[3].value);
        }