Lawo.ComponentModel.PropertyChangedTest.TestCore C# (CSharp) Method

TestCore() private method

private TestCore ( IDisposable>.Func createCalculated, bool creationIsNotified, PropertyChangedEventHandler validate ) : void
createCalculated IDisposable>.Func
creationIsNotified bool
validate PropertyChangedEventHandler
return void
        private void TestCore(
            Func<PropertyChangedEventHandler, IDisposable> createCalculated,
            bool creationIsNotified,
            PropertyChangedEventHandler validate,
            params Addend[] addends)
        {
            int totalCount;
            var changedCount = 0;

            using (createCalculated(validate + ((s, e) => ++changedCount)))
            {
                totalCount = this.IncrementAddends(0, addends) + (creationIsNotified ? 1 : 0);
                Assert.AreEqual(totalCount, changedCount);
            }

            foreach (var addend in addends)
            {
                addend.AddendValue = 0;
            }

            Assert.AreEqual(totalCount, changedCount);
        }

Usage Example

Beispiel #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);
            }
All Usage Examples Of Lawo.ComponentModel.PropertyChangedTest::TestCore