コード例 #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 Stream && actual is Stream)
     {
         DisplayStreamDifferences(writer, (Stream)expected, (Stream)actual, depth);
     }
     else if (comparer.Tolerance != null)
     {
         writer.DisplayDifferences(expected, actual, comparer.Tolerance);
     }
     else
     {
         writer.DisplayDifferences(expected, actual);
     }
 }
コード例 #2
0
ファイル: Constraint.cs プロジェクト: veerendrap/AutoTest.Net
 /// <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);
 }