Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 /// <summary>
 ///     Write the failure message to the MessageWriter provided
 ///     as an argument. The default implementation simply passes
 ///     the constraint and the internalActual 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);
 }