public void PauseAggregation_OneItemAddedToCollection_ValueUpdatedAfterUsingBlockExits() { ContinuousValue<int> sum = _source.ContinuousSum(p => p.Age); Assert.AreEqual(30, sum.CurrentValue); int callCount = 0; sum.PropertyChanged += (sender, args) => callCount++; using (PausedAggregation pausedAggregation = new PausedAggregation()) { _source.Add(new Person() { Age = 30 }); Assert.AreEqual(0, callCount); } Assert.AreEqual(1, callCount); }
public void PauseAggregation_NestedPauses_ValueUpdatedAfterUsingBlockExits() { ContinuousValue<int> sum = _source.ContinuousSum(p => p.Age); Assert.AreEqual(30, sum.CurrentValue); int callCount = 0; sum.PropertyChanged += (sender, args) => callCount++; using (PausedAggregation pausedAggregation = new PausedAggregation()) { using (PausedAggregation pausedAggregationTwo = new PausedAggregation()) { _source[0].Age = 1000; Assert.AreEqual(0, callCount); } } Assert.AreEqual(1, callCount); }