public void NotifyPropertyChanged_Expression_Integer_AutoActivate_True()
        {
            var actionRaised = false;
            var notifyPropertyChangedTestObject = new ParameterTestObject();

            using var observer1 = ParameterObserver.Observes(
                      notifyPropertyChangedTestObject.IntPropertyExpression,
                      () => actionRaised = true);
            Assert.False(actionRaised);
            notifyPropertyChangedTestObject.IntParameter.Value = 2;
            Assert.True(actionRaised);
        }
        ReactiveParameterObservers_BehaviorParameterObserver_OwnerExpression_ComplexProperty_Value_Integer_AutoActivate_True4()
        {
            var value = 0;
            var notifyPropertyChangedTestObject = new ParameterTestObject();

            notifyPropertyChangedTestObject.IntParameter.Value    = 1;
            notifyPropertyChangedTestObject.ComplexProperty.Value = new ComplexParameterType();
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 1;

            using var observer1 = Common.Parameters.Reactive.BehaviorObserverFactory.Observes(
                      notifyPropertyChangedTestObject,
                      o => o.ComplexProperty.Value.IntProperty.Value);
            using var d = observer1.Subscribe(v => value = v);

            Assert.AreEqual(1, value);
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 2;
            Assert.AreEqual(2, value);
        }
        public void NotifyPropertyChanged_OwnerExpression_ComplexProperty_Value_Integer_AutoActivate_True2()
        {
            var value = 0;
            var notifyPropertyChangedTestObject = new ParameterTestObject();

            notifyPropertyChangedTestObject.IntParameter.Value    = 1;
            notifyPropertyChangedTestObject.ComplexProperty.Value = new ComplexParameterType();
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 1;

            using var observer1 = ParameterObserverFactory.Observes(
                      notifyPropertyChangedTestObject,
                      o => o.ComplexProperty.Value.IntProperty.Value,
                      v => value = v);

            Assert.AreEqual(0, value);
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 2;
            Assert.AreEqual(2, value);
        }
        public void NotifyPropertyChanged_OwnerExpression_ComplexProperty_Value_Integer_AutoActivate_True()
        {
            var actionRaised = false;
            var notifyPropertyChangedTestObject = new ParameterTestObject();

            notifyPropertyChangedTestObject.IntParameter.Value    = 10;
            notifyPropertyChangedTestObject.ComplexProperty.Value = new ComplexParameterType();
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 11;

            using var observer1 = ParameterObserver.Observes(
                      notifyPropertyChangedTestObject,
                      o => o.ComplexProperty.Value.IntProperty.Value,
                      () => { actionRaised = true; });
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.ValueChanged += (sender, args) =>
            {
                var i = 1;
            };
            Assert.False(actionRaised);
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 2;
            Assert.True(actionRaised);
        }
        ReactiveParameterObservers_ReplayParameterObserver_OwnerExpression_ComplexProperty_Value_Integer_AutoActivate_True4()
        {
            var value = (int?)null;
            var count = 0;
            var notifyPropertyChangedTestObject = new ParameterTestObject();

            using var observer1 = Common.Parameters.Reactive.ReplayObserverFactory.Observes(
                      notifyPropertyChangedTestObject,
                      o => o.ComplexProperty.Value.IntProperty.Value);

            var a = notifyPropertyChangedTestObject.ComplexProperty.Value?.IntProperty.Value;
            Expression <Func <ParameterTestObject, int?> > exp = (o => o.ComplexProperty.Value.IntProperty.Value);

            //  var x = exp.Compile()(notifyPropertyChangedTestObject);
            notifyPropertyChangedTestObject.IntParameter.Value    = 1;
            notifyPropertyChangedTestObject.ComplexProperty.Value = new ComplexParameterType();
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 1;
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 2;

            Assert.AreEqual(null, value);
            Assert.AreEqual(0, count);

            using var d = observer1.Subscribe(
                      v =>
            {
                count++;
                value = v;
            });

            Assert.AreEqual(2, value);
            Assert.AreEqual(3, count);
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 3;
            Assert.AreEqual(3, value);
            Assert.AreEqual(4, count);
            notifyPropertyChangedTestObject.ComplexProperty.Value = null;
            Assert.AreEqual(null, value);
        }
        public void NotifyPropertyChanged_OwnerExpression_ComplexProperty_Value_Integer_AutoActivate_True4()
        {
            var value = 0;
            var notifyPropertyChangedTestObject = new ParameterTestObject();

            notifyPropertyChangedTestObject.IntParameter.Value    = 1;
            notifyPropertyChangedTestObject.ComplexProperty.Value = new ComplexParameterType();
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 1;

            using var observer1 = ParameterObserverFactory.Observes(
                      notifyPropertyChangedTestObject,
                      o => o.ComplexProperty.Value.IntProperty.Value);
            Assert.AreEqual(0, observer1.SubscribedLength);
            void Ev(int v) => value = v;

            observer1.ParameterChanged += Ev;
            Assert.AreEqual(1, observer1.SubscribedLength);

            Assert.AreEqual(0, value);
            notifyPropertyChangedTestObject.ComplexProperty.Value.IntProperty.Value = 2;
            Assert.AreEqual(2, value);
            observer1.ParameterChanged -= Ev;
            Assert.AreEqual(0, observer1.SubscribedLength);
        }