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); }
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); }
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); }
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); }