예제 #1
0
        public void Revalidate_OtherItemBecomesInvalid_RevalidatesOtherItem()
        {
            Results.EnabledValidators = ValidatorTypes.Property;

            Results.SetupFailing().PropertyValidation
            .Targeting(ItemABC, x => x.ItemProperty)
            .On(ItemABC);

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemABC, x => x.ItemProperty)
            .On(OwnerOfAB, CollectionAValidatorKey);

            ItemA.Revalidate(x => x.ItemProperty);;
            Results.VerifySetupValidationResults();
        }
예제 #2
0
        public void MultipleItemsAreInvalidInSingleCollection_OneInvalidItemIsRevalidated_RevalidatesInvalidItemsAndAddsErrors()
        {
            Results.EnabledValidators = ValidatorTypes.Property;

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemA, x => x.ItemProperty)
            .On(OwnerOfAB, CollectionAValidatorKey);

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemAB, x => x.ItemProperty)
            .On(OwnerOfAB, CollectionAValidatorKey);

            ItemA.Revalidate(x => x.ItemProperty);;

            Results.VerifySetupValidationResults();
        }
예제 #3
0
        public void Revalidate_OtherItemWasPreviouslyInvalid_ValidatesUnvalidatedCollectionsOfOtherItem()
        {
            Results.EnabledValidators = ValidatorTypes.Property;

            Results.SetFailed("Previous error").CollectionPropertyValidation
            .Targeting(ItemABC, x => x.ItemProperty)
            .On(OwnerOfAB, CollectionAValidatorKey);

            ItemA.Revalidate(x => x.ItemProperty);

            ExpectItemPropertyValidationOf(ItemA);
            ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionA);

            ExpectItemPropertyValidationOf(ItemABC);
            ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionB);
            ExpectCollectionPropertyValidationOf(OwnerOfC.CollectionC);

            Results.VerifyInvocationSequence();
        }
예제 #4
0
        public void Revalidate_OtherItemBecomesInvalid_ValidatesUnvalidatedOwnerCollectionsOfOtherItems()
        {
            Results.EnabledValidators = ValidatorTypes.Property;

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemABC, x => x.ItemProperty)
            .On(OwnerOfAB, CollectionAValidatorKey);

            ItemA.Revalidate(x => x.ItemProperty);;

            ExpectItemPropertyValidationOf(ItemA);
            ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionA);

            ExpectItemPropertyValidationOf(ItemABC);
            ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionB);
            ExpectCollectionPropertyValidationOf(OwnerOfC.CollectionC);

            Results.VerifyInvocationSequence();
        }
예제 #5
0
        public void MultipleItemsAreInvalidInSingleCollection_OneInvalidItemIsRevalidated_ValidatesOwnerCollectionsAndRevalidatesInvalidItems()
        {
            Results.EnabledValidators = ValidatorTypes.Property;

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemA, x => x.ItemProperty)
            .On(OwnerOfAB, CollectionAValidatorKey);

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemAB, x => x.ItemProperty)
            .On(OwnerOfAB, CollectionAValidatorKey);

            ItemA.Revalidate(x => x.ItemProperty);;

            ExpectItemPropertyValidationOf(ItemA);
            ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionA);
            ExpectItemPropertyValidationOf(ItemAB);
            ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionB);

            Results.VerifyInvocationSequence();
        }