/// <summary> /// Apply a constraint to an internalActual value, succeeding if the constraint /// is satisfied and throwing an InconclusiveException on failure. /// </summary> /// <param name="expression">A Constraint expression to be applied</param> /// <param name="actual">The internalActual 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, IResolveConstraint expression, string message, params object[] args) { Constraint constraint = expression.Resolve(); if (!constraint.Matches(actual)) { MessageWriter writer = new TextMessageWriter(message, args); constraint.WriteMessageTo(writer); throw new AssertInconclusiveException(writer.ToString()); } }
/// <summary> /// Apply a constraint to an internalActual value, succeeding if the constraint /// is satisfied and throwing an InconclusiveException on failure. /// </summary> /// <param name="del">An ActualValueDelegate returning the value to be tested</param> /// <param name="expr">A Constraint expression to be applied</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(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args) { Constraint constraint = expr.Resolve(); if (!constraint.Matches(del)) { MessageWriter writer = new TextMessageWriter(message, args); constraint.WriteMessageTo(writer); throw new AssertInconclusiveException(writer.ToString()); } }