public abstract DisplayDifferences ( NUnit.Framework.Constraints.ConstraintResult result ) : void | ||
result | NUnit.Framework.Constraints.ConstraintResult | The failing constraint result |
return | void |
private void DisplayDifferences(MessageWriter writer, object expected, object actual, int depth) { if (expected is string && actual is string) { DisplayStringDifferences(writer, (string)expected, (string)actual); } else if (expected is ICollection && actual is ICollection) { DisplayCollectionDifferences(writer, (ICollection)expected, (ICollection)actual, depth); } else if (expected is IEnumerable && actual is IEnumerable) { DisplayEnumerableDifferences(writer, (IEnumerable)expected, (IEnumerable)actual, depth); } else if (expected is Stream && actual is Stream) { DisplayStreamDifferences(writer, (Stream)expected, (Stream)actual, depth); } else if (tolerance != null) { writer.DisplayDifferences(expected, actual, tolerance); } else { writer.DisplayDifferences(expected, actual); } }
/// <summary> /// Write the failure message to the MessageWriter provided /// as an argument. The default implementation simply passes /// the constraint and the actual value to the writer, which /// then displays the constraint description and the value. /// /// Constraints that need to provide additional details, /// such as where the error occured can override this. /// </summary> /// <param name="writer">The MessageWriter on which to display the message</param> public virtual void WriteMessageTo(MessageWriter writer) { writer.DisplayDifferences(this); }
private void DisplayDifferences(MessageWriter writer, object expected, object actual, int depth) { if (expected is string && actual is string) DisplayStringDifferences(writer, (string)expected, (string)actual); else if (expected is ICollection && actual is ICollection) DisplayCollectionDifferences(writer, (ICollection)expected, (ICollection)actual, depth); else if (expected is Stream && actual is Stream) DisplayStreamDifferences(writer, (Stream)expected, (Stream)actual, depth); else if ( tolerance != null ) writer.DisplayDifferences( expected, actual, tolerance ); else writer.DisplayDifferences(expected, actual); }
/// <summary> /// Write the failure message to the MessageWriter provided /// as an argument. The default implementation simply passes /// the constraint and the actual value to the writer, which /// then displays the constraint description and the value. /// /// Constraints that need to provide additional details, /// such as where the error occured can override this. /// </summary> /// <param name="writer">The MessageWriter on which to display the message</param> public virtual void WriteMessageTo(MessageWriter writer) { writer.DisplayDifferences(this); }
public override void WriteMessageTo(MessageWriter writer) { writer.WriteMessageLine("Difference at {0}", Path); writer.DisplayDifferences(Expected, Actual); }