/// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        /// <returns>
        /// A string that represents the current object.
        /// </returns>
        /// <filterpriority>2</filterpriority>
        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("- Use ")
            .Append(useRuntimeTyping ? "runtime" : "declared")
            .AppendLine(" types and members");

            if (isRecursive)
            {
                if (allowInfiniteRecursion)
                {
                    builder.AppendLine("- Recurse indefinitely");
                }
            }

            builder.AppendFormat("- Compare enums by {0}" + Environment.NewLine,
                                 enumEquivalencyHandling == EnumEquivalencyHandling.ByName ? "name" : "value");

            if (cyclicReferenceHandling == CyclicReferenceHandling.Ignore)
            {
                builder.AppendLine("- Ignoring cyclic references");
            }

            foreach (IMemberSelectionRule rule in selectionRules)
            {
                builder.Append("- ").AppendLine(rule.ToString());
            }

            foreach (IMemberMatchingRule rule in matchingRules)
            {
                builder.Append("- ").AppendLine(rule.ToString());
            }

            foreach (IEquivalencyStep step in userEquivalencySteps)
            {
                builder.Append("- ").AppendLine(step.ToString());
            }

            foreach (IOrderingRule rule in orderingRules)
            {
                builder.Append("- ").AppendLine(rule.ToString());
            }

            builder.Append("- ").AppendLine(ConversionSelector.ToString());

            return(builder.ToString());
        }
 /// <summary>
 ///     Instructs the equivalency comparison to prevent trying to convert the value of
 ///     a specific property on the expectation object before running any of the other steps.
 /// </summary>
 public TSelf WithoutAutoConversionFor(Expression <Func <IMemberInfo, bool> > predicate)
 {
     ConversionSelector.Exclude(predicate);
     return((TSelf)this);
 }
 /// <summary>
 ///     Instructs the equivalency comparison to try to convert the values of
 ///     matching properties before running any of the other steps.
 /// </summary>
 public TSelf WithAutoConversion()
 {
     ConversionSelector.IncludeAll();
     return((TSelf)this);
 }
 /// <summary>
 ///     Gets an ordered collection of Equivalency steps how a subject is compared with the expectation.
 /// </summary>
 IEnumerable <IEquivalencyStep> IEquivalencyAssertionOptions.GetUserEquivalencySteps(ConversionSelector conversionSelector) =>
 userEquivalencySteps.Concat(new[] { new TryConversionStep(conversionSelector) });
コード例 #5
0
 public IEnumerable <IEquivalencyStep> GetUserEquivalencySteps(ConversionSelector conversionSelector)
 {
     return(inner.GetUserEquivalencySteps(conversionSelector).Select(step => new CollectionMemberAssertionRuleDecorator(step)).ToArray());
 }
コード例 #6
0
 public TryConversionStep(ConversionSelector selector)
 {
     this.selector = selector;
 }