コード例 #1
0
        public void AllItemsBecomeInvalid_RevalidatesAllItems()
        {
            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);

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

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

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

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemABC, x => x.ItemProperty)
            .On(OwnerOfC, CollectionCValidatorKey);

            Results.SetupFailing().CollectionPropertyValidation
            .Targeting(ItemC, x => x.ItemProperty)
            .On(OwnerOfC, CollectionCValidatorKey);

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

            Results.VerifySetupValidationResults();
        }
コード例 #2
0
 public void ItemIsValid_NoErrorIsAdded()
 {
     ItemAB.Revalidate(x => x.ItemProperty);;
     ValidationAssert.IsValid(ItemAB);
 }