コード例 #1
0
        public void RevalidatePropertyValidationsSelfOnly_CallsRevalidationBehaviorOfProperty()
        {
            Revalidator.RevalidatePropertyValidations(VM, VM.Property, ValidationScope.Self);

            Assert.AreEqual(RevalidateProperty, ActionLog);
            Assert.AreEqual(VM.GetContext(), VM.PropertyBehavior.LastRevalidateContext);
            Assert.IsNotNull(VM.PropertyBehavior.LastRevalidateContext);
        }
コード例 #2
0
        public void RevalidatePropertyValidationsDescendants_CallsRevalidationAndDescendantsValidationBehavior()
        {
            var scope = ValidationScope.SelfAndAllDescendants;

            Revalidator.RevalidatePropertyValidations(VM, VM.Property, scope);

            Assert.AreEqual(RevalidateDescendants + RevalidateProperty, ActionLog);
            Assert.AreEqual(VM.GetContext(), VM.PropertyBehavior.LastDescendantsContext);
            Assert.AreEqual(scope, VM.PropertyBehavior.LastDescendantsScope);
        }
コード例 #3
0
        protected void SetFailedResult(ValidatorInvocation target, string errorDetails)
        {
            var stateBefore = GetState();

            SetupFailingValidator(target, errorDetails);
            if (target.TargetProperty != null)
            {
                Revalidator.RevalidatePropertyValidations(
                    target.TargetVM,
                    target.TargetProperty,
                    ValidationScope.Self
                    );
            }
            else
            {
                Revalidator.RevalidateViewModelValidations(target.TargetVM);
            }

            stateBefore.RestoreToState();
        }