Пример #1
0
 /// <summary>
 /// Apply a constraint to an actual value, succeedingt if the constraint
 /// is satisfied and throwing an assertion exception on failure.
 /// </summary>
 /// <param name="constraint">An IConstraint to be applied</param>
 /// <param name="actual">The actual value to test</param>
 /// <param name="message">The message that will be displayed on failure</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void That( object actual, IConstraint constraint, string message, params object[] args )
 {
     Assert.IncrementAssertCount();
     if ( !constraint.Matches( actual ) )
     {
         MessageWriter writer = new TextMessageWriter( message, args );
         constraint.WriteMessageTo( writer );
         throw new AssertionException( writer.ToString() );
     }
 }