IncrementAssertCount() private static method

private static IncrementAssertCount ( ) : void
return void
Example #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">A Constraint 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>
 static public void That(object actual, Constraint 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());
     }
 }
Example #2
0
        /// <summary>
        /// Apply a constraint to a referenced value, succeeding if the constraint
        /// is satisfied and throwing an assertion exception on failure.
        /// </summary>
        /// <param name="constraint">A Constraint 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>
        static public void That(ref bool actual, IResolveConstraint expression, string message, params object[] args)
        {
            Constraint constraint = expression.Resolve();

            Assert.IncrementAssertCount();
            if (!constraint.Matches(ref actual))
            {
                MessageWriter writer = new TextMessageWriter(message, args);
                constraint.WriteMessageTo(writer);
                throw new AssertionException(writer.ToString());
            }
        }