Ejemplo n.º 1
0
        public void WhenPropertyRightChangesChangeNotificationIsThrown()
        {
            var left = new ActiveCombineLeftTestClass()
            {
                PropertyLeft = 100
            };
            var right = new ActiveCombineRightTestClass()
            {
                PropertyRight = 200
            };
            var outer = new ActiveCombineTestOuterClass()
            {
                ContainerLeft = left, ContainerRight = right
            };

            var sut = outer.ToActiveValue(i => i.ContainerLeft).ActiveCombine(outer.ToActiveValue(i => i.ContainerRight), (l, r) => l.PropertyLeft + r.PropertyRight);

            bool called = false;

            sut.PropertyChanged += (s, e) => called = true;

            right.PropertyRight = 300;

            Assert.True(called);
        }
Ejemplo n.º 2
0
        public void WhenPropertyRightChangesValueChanges()
        {
            var left = new ActiveCombineLeftTestClass()
            {
                PropertyLeft = 100
            };
            var right = new ActiveCombineRightTestClass()
            {
                PropertyRight = 200
            };
            var outer = new ActiveCombineTestOuterClass()
            {
                ContainerLeft = left, ContainerRight = right
            };

            var sut = outer.ToActiveValue(i => i.ContainerLeft).ActiveCombine(outer.ToActiveValue(i => i.ContainerRight), (l, r) => l.PropertyLeft + r.PropertyRight);

            right.PropertyRight = 300;

            Assert.Equal(sut.Value, outer.ContainerLeft.PropertyLeft + outer.ContainerRight.PropertyRight);
        }