DisplayDifferences() public abstract method

Display Expected and Actual lines for a constraint. This is called by MessageWriter's default implementation of WriteMessageTo and provides the generic two-line display.
public abstract DisplayDifferences ( NUnit.Framework.Constraints.ConstraintResult result ) : void
result NUnit.Framework.Constraints.ConstraintResult The failing constraint result
return void
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);
     }
 }
 /// <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);
 }
Esempio n. 3
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 ( tolerance != null )
				writer.DisplayDifferences( expected, actual, tolerance );
            else
                writer.DisplayDifferences(expected, actual);
        }
Esempio n. 4
0
 /// <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);
 }