public void GetResults_ItemIsInvalidInMultipleCollections_ValidatesOnlyOwnerCollectionsOfThatItem() { Results.EnabledValidators = ValidatorTypes.Property; 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); ItemABC.Revalidate(x => x.ItemProperty);; ExpectItemPropertyValidationOf(ItemABC); ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionA); ExpectCollectionPropertyValidationOf(OwnerOfAB.CollectionB); ExpectCollectionPropertyValidationOf(OwnerOfC.CollectionC); Results.VerifyInvocationSequence(); }
public void GetResults_ItemIsInvalidInMultipleCollections_AddsErrorsOfAllCollectionsToItem() { Results.EnabledValidators = ValidatorTypes.Property; 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); ItemABC.Revalidate(x => x.ItemProperty);; Results.VerifySetupValidationResults(); }