Exemple #1
0
        public void ObserveElement()
        {
            var one = new TestModel { StringProperty = "1" };
            var two = new TestModel { StringProperty = "2" };
            var list = new RxList<TestModel>(one, two);
            string s = null;
            list.ObserveElementProperty(x => x.StringProperty).Subscribe(x => s = x.Value);

            list[0].StringProperty = "foo";
            Assert.AreEqual("foo", s);

            list.Remove(one);
            one.StringProperty = "bar";
            Assert.AreEqual("foo", s);

            list[0] = new TestModel { StringProperty = "3" };
            Assert.AreEqual("3", s);
        }