internal CalculatedSum(PropertyChangedTest test, int propertyCount) { this.addends = Enumerable.Range(1, propertyCount).Select(i => new Addend()).ToArray(); this.sum = CreateSum(this.GetProperty(o => o.SumValue), this.addends); Func <PropertyChangedEventHandler, IDisposable> createCalculated = handler => { this.PropertyChanged += handler; return(this.sum); }; PropertyChangedEventHandler validateHandler = (s, e) => { Assert.AreEqual(this, s); Assert.AreEqual("SumValue", e.PropertyName); Assert.AreEqual(this.addends.Aggregate(0, (sum, addend) => sum + addend.AddendValue), this.SumValue); }; test.TestCore(createCalculated, false, validateHandler, this.addends); }
internal CalculatedSum(PropertyChangedTest test, int propertyCount) { this.addends = Enumerable.Range(1, propertyCount).Select(i => new Addend()).ToArray(); this.sum = CreateSum(this.GetProperty(o => o.SumValue), this.addends); Func<PropertyChangedEventHandler, IDisposable> createCalculated = handler => { this.PropertyChanged += handler; return this.sum; }; PropertyChangedEventHandler validateHandler = (s, e) => { Assert.AreEqual(this, s); Assert.AreEqual("SumValue", e.PropertyName); Assert.AreEqual(this.addends.Aggregate(0, (sum, addend) => sum + addend.AddendValue), this.SumValue); }; test.TestCore(createCalculated, false, validateHandler, this.addends); }