Beispiel #1
0
        public void HandleChange_WithValidationResultChangedOfOwnProperty_UpdatesCachedResults()
        {
            var vm = new TestVM();

            var expected = new ExpectedResults {
                Properties = CreateValidationResult("First property error")
            };

            vm.FirstPropertyResultSetup = expected.Properties;
            vm.CallHandleChangeForFirstProperty();

            AssertBehaviorResults(vm, expected);
        }
Beispiel #2
0
        public void HandleChange_WithValidationResultChangedOfOwnProperty_UpdatesBehaviorOfParentViewModel()
        {
            var child  = new TestVM();
            var parent = new TestVM();

            parent.MakePropertiesAndViewModelInvalid();
            child.FirstPropertyResultSetup = CreateValidationResult("Property error");

            child.Kernel.Parents.Add(parent);
            child.CallHandleChangeForFirstProperty();

            var expectedParentResult = parent.GetCurrentlySetupResults();

            expectedParentResult.Descenants = child.ValidationResult;

            AssertBehaviorResults(parent, expectedParentResult);
        }
Beispiel #3
0
        public void HandleChange_UpdatesBehaviorOfParentViewModelBeforeCallingHandleChangeNext()
        {
            var child  = new TestVM();
            var parent = new TestVM();

            child.FirstPropertyResultSetup = CreateValidationResult("Property error");
            child.Kernel.Parents.Add(parent);

            child.NextChangeHandler.HandleChangeNext += delegate {
                // Assert parent was already updated
                var expected = new ExpectedResults {
                    Descenants = child.FirstPropertyResultSetup
                };
                AssertBehaviorResults(parent, expected);
            };

            child.CallHandleChangeForFirstProperty();
        }