Beispiel #1
0
        public void PropertyForObservable()
        {
            var testObject = new TestObject();
            var stringPropertyObservable = testObject.ObserveProperty(x => x.StringProperty);

            var observableObject = new PropertyForObservableObject();
            observableObject.ObservableAsProperty(stringPropertyObservable, x => x.ProxyProperty);

            Assert.IsNull(observableObject.ProxyProperty);

            testObject.StringProperty = "foo";
            Assert.AreEqual("foo", observableObject.ProxyProperty);
        }
Beispiel #2
0
        public void ObservePropertyInitialValue()
        {
            var obj = new TestObject();
            string value = "error";
            obj.ObserveProperty(x => x.StringProperty).Subscribe(x => value = x);

            Assert.IsNull(value);
        }
Beispiel #3
0
        public void ObservePropertyInitialValueAlreadySet()
        {
            var obj = new TestObject();
            obj.StringProperty = "foo";
            string value = null;
            obj.ObserveProperty(x => x.StringProperty).Subscribe(x => value = x);

            Assert.AreEqual("foo", value);
        }
Beispiel #4
0
        public void ObservePropertyChanged()
        {
            var obj = new TestObject();
            string value = "error";
            obj.ObserveProperty(x => x.StringProperty).Subscribe(x => value = x);
            Assert.IsNull(value);

            obj.StringProperty = "foo";
            Assert.AreEqual("foo", value);
        }