예제 #1
0
파일: AnyTest.cs 프로젝트: mlessmann/NMF
        public void LambdaAny_ObservableSource_NoUpdateWhenDetached()
        {
            var update = false;
            var coll   = new NotifyCollection <int>()
            {
                -1, -2
            };

            var test = Observable.Expression(() => coll.Any(i => i > 0));

            test.ValueChanged += (o, e) => update = true;

            Assert.IsFalse(test.Value);
            Assert.IsFalse(update);

            test.Detach();

            coll.Add(1);

            Assert.IsFalse(update);

            test.Attach();

            Assert.IsTrue(update);
            Assert.IsTrue(test.Value);
            update = false;

            coll.Remove(1);

            Assert.IsTrue(update);
        }
예제 #2
0
        public void LambdaAny_ObservableSourceReset_Update()
        {
            var update = false;
            var coll   = new NotifyCollection <int>()
            {
                1, 2, 3
            };

            var test = Observable.Expression(() => coll.Any(i => i > 0));

            test.ValueChanged += (o, e) => update = true;

            coll.Clear();

            Assert.IsTrue(update);
        }
예제 #3
0
파일: AnyTest.cs 프로젝트: FrederikP/NMF
        public void LambdaAny_ObservableSourceReset_Update()
        {
            var update = false;
            var coll = new NotifyCollection<int>() { 1, 2, 3 };

            var test = Observable.Expression(() => coll.Any(i => i > 0));

            test.ValueChanged += (o, e) => update = true;

            coll.Clear();

            Assert.IsTrue(update);
        }
예제 #4
0
파일: AnyTest.cs 프로젝트: FrederikP/NMF
        public void LambdaAny_ObservableSource_NoUpdateWhenDetached()
        {
            var update = false;
            var coll = new NotifyCollection<int>() { -1, -2 };

            var test = Observable.Expression(() => coll.Any(i => i > 0));

            test.ValueChanged += (o, e) => update = true;

            Assert.IsFalse(test.Value);
            Assert.IsFalse(update);

            test.Detach();

            coll.Add(1);

            Assert.IsFalse(update);

            test.Attach();

            Assert.IsTrue(update);
            Assert.IsTrue(test.Value);
            update = false;

            coll.Remove(1);

            Assert.IsTrue(update);
        }