コード例 #1
0
            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);
            }
コード例 #2
0
            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);
            }