Пример #1
0
        public void PropertyChangedShouldBeBubbledToArgument()
        {
            var function = new Function();
            function.Arguments.Add(new Variable<TestNotifyPropertyChangedObject>());
            function.Components.Add(new Variable<double>());

            var testNotifyPropertyChangedObject = new TestNotifyPropertyChangedObject();
            function[testNotifyPropertyChangedObject] = 1.0d;

            var callCount = 0;
            ((INotifyPropertyChanged) function.Arguments[0]).PropertyChanged += delegate { callCount++; };

            testNotifyPropertyChangedObject.FireChanged();

            Assert.AreEqual(1, callCount);
        }
Пример #2
0
        public void AddingValueToSortedArrayKeepsOldSubscribtion()
        {
            var array = new MultiDimensionalArray<TestNotifyPropertyChangedObject> { IsAutoSorted = true };

            var testNotifyPropertyChangedObject = new TestNotifyPropertyChangedObject {Value = 10};
            array.Add(testNotifyPropertyChangedObject);
            array.Add(new TestNotifyPropertyChangedObject { Value = 5 });//this will cause sorting

            int callCount = 0;
            ((INotifyPropertyChanged) array).PropertyChanged += (s, e) => { callCount++; };
            testNotifyPropertyChangedObject.FireChanged();

            Assert.AreEqual(1,callCount);
        }