コード例 #1
0
        public void Property_Set_ShouldExecuteSubscribedActionsOfComputedPropertiesRecursivelyWithValueComputedFromSourceProperty()
        {
            // Arrange
            int?nullableIntSubscriptionParameterValue = null;
            int?property1SubscriptionParameterValue   = null;
            int?property2SubscriptionParameterValue   = null;
            int?propertyComputedFromProperty1SubscriptionParameterValue = null;

            var viewModel = new TestViewModel();

            viewModel.AddSubscriptions
            (
                i => nullableIntSubscriptionParameterValue = i,
                i => property1SubscriptionParameterValue   = i,
                i => property2SubscriptionParameterValue   = i,
                i => propertyComputedFromProperty1SubscriptionParameterValue = i
            );

            // Act
            viewModel.NullableInt = 12;

            // Assert
            Assert.That(nullableIntSubscriptionParameterValue, Is.EqualTo(12));
            Assert.That(property1SubscriptionParameterValue, Is.EqualTo(13));
            Assert.That(property2SubscriptionParameterValue, Is.EqualTo(13));
            Assert.That(propertyComputedFromProperty1SubscriptionParameterValue, Is.EqualTo(14));
        }