Beispiel #1
0
        /// <summary>
        /// Creates an instance of the equivalency assertions options based on defaults previously configured by the caller.
        /// </summary>
        protected SelfReferenceEquivalencyAssertionOptions(IEquivalencyAssertionOptions defaults)
        {
            allowInfiniteRecursion  = defaults.AllowInfiniteRecursion;
            isRecursive             = defaults.IsRecursive;
            cyclicReferenceHandling = defaults.CyclicReferenceHandling;
            allowInfiniteRecursion  = defaults.AllowInfiniteRecursion;
            enumEquivalencyHandling = defaults.EnumEquivalencyHandling;
            useRuntimeTyping        = defaults.UseRuntimeTyping;
            includeProperties       = defaults.IncludeProperties;
            includeFields           = defaults.IncludeFields;

            selectionRules.AddRange(defaults.SelectionRules);
            userEquivalencySteps.AddRange(defaults.UserEquivalencySteps);
            matchingRules.AddRange(defaults.MatchingRules);
            orderingRules = new OrderingRuleCollection(defaults.OrderingRules);

            RemoveSelectionRule <AllPublicPropertiesSelectionRule>();
            RemoveSelectionRule <AllPublicFieldsSelectionRule>();
        }
        /// <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;

            selectionRules.AddRange(defaults.SelectionRules);
            userEquivalencySteps.AddRange(defaults.UserEquivalencySteps);
            matchingRules.AddRange(defaults.MatchingRules);
            orderingRules      = new OrderingRuleCollection(defaults.OrderingRules);
            ConversionSelector = defaults.ConversionSelector.Clone();

            getDefaultEqualityStrategy = defaults.GetEqualityStrategy;
            TraceWriter = defaults.TraceWriter;

            RemoveSelectionRule <AllPublicPropertiesSelectionRule>();
            RemoveSelectionRule <AllPublicFieldsSelectionRule>();
        }
        /// <summary>
        /// Creates an instance of the equivalency assertions options based on defaults previously configured by the caller.
        /// </summary>
        protected EquivalencyAssertionOptionsBase(IEquivalencyAssertionOptions defaults)
        {
            allowInfiniteRecursion  = defaults.AllowInfiniteRecursion;
            isRecursive             = defaults.IsRecursive;
            cyclicReferenceHandling = defaults.CyclicReferenceHandling;
            allowInfiniteRecursion  = defaults.AllowInfiniteRecursion;
            enumEquivalencyHandling = defaults.EnumEquivalencyHandling;
            useRuntimeTyping        = defaults.UseRuntimeTyping;
            includeProperties       = defaults.IncludeProperties;
            includeFields           = defaults.IncludeFields;

            selectionRules.AddRange(defaults.SelectionRules.Where(IsNotStandardSelectionRule));

            if (IncludesIncludingSelectionRule(defaults.SelectionRules))
            {
                mustAddSelectionRules = false;
            }

            userEquivalencySteps.AddRange(defaults.UserEquivalencySteps);
            matchingRules.AddRange(defaults.MatchingRules);
            orderingRules = new OrderingRuleCollection(defaults.OrderingRules);
        }