public ComparisonResult Compare(IComparisonContext context, object value1, object value2) { var type1 = value1.GetType(); if (IsSkipped(type1)) { return(ComparisonResult.Inconclusive); } if (value1.Equals(value2)) { return(ComparisonResult.Pass); } if (ReflectionCache.IsValueType(type1)) { context.AddDifference(value1, value2); return(ComparisonResult.Fail); } return(ComparisonResult.Inconclusive); }
public (ComparisonResult result, IComparisonContext context) Compare(IComparisonContext context, object value1, object value2) { var type1 = value1.GetType(); var type2 = value2.GetType(); if (IsSkipped(type1) || IsSkipped(type2)) { return(ComparisonResult.Inconclusive, context); } if (type1 != type2) { if (CoerceValues(ref value1, ref value2)) { type1 = value1.GetType(); type2 = value2.GetType(); if (type1 != type2) { return(ComparisonResult.Inconclusive, context); } } } if (value1.Equals(value2)) { return(ComparisonResult.Pass, context); } if (ReflectionCache.IsValueType(type1)) { return(ComparisonResult.Fail, context.AddDifference(value1, value2)); } return(ComparisonResult.Inconclusive, context); }