/// <summary>
        /// Gets a value indicating whether this step can handle the current subject and/or expectation.
        /// </summary>
        public bool CanHandle(IEquivalencyValidationContext context, IEquivalencyAssertionOptions config)
        {
            Type             type     = config.GetExpectationType(context);
            EqualityStrategy strategy = config.GetEqualityStrategy(type);

            bool canHandle = (strategy == EqualityStrategy.Equals) || (strategy == EqualityStrategy.ForceEquals);

            if (canHandle)
            {
                context.TraceSingle(path =>
                {
                    string strategyName = (strategy == EqualityStrategy.Equals)
                        ? "Equals must be used" : "object overrides Equals";

                    return($"Treating {path} as a value type because {strategyName}.");
                });
            }

            return(canHandle);
        }
Beispiel #2
0
 public EqualityStrategy GetEqualityStrategy(Type type)
 {
     return(inner.GetEqualityStrategy(type));
 }