Ejemplo n.º 1
0
        public void PerformViewModelValidations_CallsRevalidationViewModelBehavior()
        {
            Revalidator.RevalidateViewModelValidations(VM);

            Assert.AreEqual(RevalidateViewModel, ActionLog);
            Assert.AreEqual(VM.GetContext(), VM.ViewModelBehavior.LastRevalidateContext);
            Assert.IsNotNull(VM.ViewModelBehavior.LastValidationController);
        }
 public void Refresh(
     IBehaviorContext context,
     bool executeRefreshDependencies
     )
 {
     this.ViewModelRefreshNext(context, executeRefreshDependencies);
     Revalidator.RevalidateViewModelValidations(context.VM);
 }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        public void RevalidateItems_PerformsPropertyAndViewModelValidationsForAllItems()
        {
            var items = new[] { CreateVM(), CreateVM() };

            Revalidator.RevalidateItems(items, ValidationScope.SelfAndAllDescendants);

            var expectedSequence =
                RevalidateDescendants + RevalidateDescendants +
                RevalidateProperty + RevalidateProperty +
                RevalidateViewModel + RevalidateViewModel;

            Assert.AreEqual(expectedSequence, ActionLog);
        }
Ejemplo n.º 6
0
        public void RevalidateItems_PassesSameValidationControllerToAllItems()
        {
            var first  = CreateVM();
            var second = CreateVM();
            var items  = new[] { first, second };

            Revalidator.RevalidateItems(items, ValidationScope.SelfAndAllDescendants);

            Assert.AreEqual(
                first.PropertyBehavior.LastValidationController,
                second.PropertyBehavior.LastValidationController
                );

            Assert.AreEqual(
                first.ViewModelBehavior.LastValidationController,
                second.ViewModelBehavior.LastValidationController
                );
        }
        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();
        }
 public void HandleChange(IBehaviorContext context, ChangeArgs args)
 {
     this.HandleChangedNext(context, args);
     Revalidator.RevalidateViewModelValidations(context.VM);
 }
Ejemplo n.º 9
0
 public void Revalidate_PerformsPropertyAndViewModelValidation()
 {
     Revalidator.Revalidate(VM, ValidationScope.SelfAndAllDescendants);
     Assert.AreEqual(RevalidateDescendants + RevalidateProperty + RevalidateViewModel, ActionLog);
 }
Ejemplo n.º 10
0
 public void RevalidateViewModelValidations()
 {
     Revalidator.RevalidateViewModelValidations(this);
 }