public bool Handle(IEquivalencyValidationContext context, IEquivalencyValidator parent, IEquivalencyAssertionOptions config) { foreach (IEquivalencyStep step in config.GetUserEquivalencySteps(config.ConversionSelector)) { if (step.CanHandle(context, config) && step.Handle(context, parent, config)) { return(true); } } return(false); }
/// <summary> /// Creates an instance of the equivalency assertions options based on defaults previously configured by the caller. /// </summary> protected SelfReferenceEquivalencyAssertionOptions(IEquivalencyAssertionOptions defaults) { isRecursive = defaults.IsRecursive; cyclicReferenceHandling = defaults.CyclicReferenceHandling; allowInfiniteRecursion = defaults.AllowInfiniteRecursion; enumEquivalencyHandling = defaults.EnumEquivalencyHandling; useRuntimeTyping = defaults.UseRuntimeTyping; includeProperties = defaults.IncludeProperties; includeFields = defaults.IncludeFields; ConversionSelector = defaults.ConversionSelector.Clone(); selectionRules.AddRange(defaults.SelectionRules); userEquivalencySteps.AddRange(defaults.GetUserEquivalencySteps(ConversionSelector)); matchingRules.AddRange(defaults.MatchingRules); orderingRules = new OrderingRuleCollection(defaults.OrderingRules); getDefaultEqualityStrategy = defaults.GetEqualityStrategy; TraceWriter = defaults.TraceWriter; RemoveSelectionRule <AllPublicPropertiesSelectionRule>(); RemoveSelectionRule <AllPublicFieldsSelectionRule>(); }
public bool Handle(IEquivalencyValidationContext context, IEquivalencyValidator parent, IEquivalencyAssertionOptions config) { return(config.GetUserEquivalencySteps(config.ConversionSelector) .Any(step => step.CanHandle(context, config) && step.Handle(context, parent, config))); }
public IEnumerable <IEquivalencyStep> GetUserEquivalencySteps(ConversionSelector conversionSelector) { return(inner.GetUserEquivalencySteps(conversionSelector).Select(step => new CollectionMemberAssertionRuleDecorator(step)).ToArray()); }