/// <summary> /// Apply a constraint to an actual value, succeeding if the constraint /// is satisfied and issuing a warning on failure. /// </summary> /// <typeparam name="TActual">The Type being compared.</typeparam> /// <param name="actual">The actual value to test</param> /// <param name="expression">A Constraint expression to be applied</param> public static void Unless <TActual>(TActual actual, IResolveConstraint expression) { Warn.Unless(actual, expression, null, null); }
/// <summary> /// Apply a constraint to an actual value, succeeding if the constraint /// is satisfied and issuing a warning on failure. /// </summary> /// <typeparam name="TActual">The Type being compared.</typeparam> /// <param name="del">An ActualValueDelegate returning the value to be tested</param> /// <param name="expr">A Constraint expression to be applied</param> public static void Unless <TActual>(ActualValueDelegate <TActual> del, IResolveConstraint expr) { Warn.Unless(del, expr.Resolve(), null, null); }
/// <summary> /// Asserts that a condition is true. If the condition is false the method throws /// an <see cref="InconclusiveException"/>. /// </summary> /// <param name="condition">A lambda that returns a Boolean</param> /// <param name="getExceptionMessage">A function to build the message included with the Exception</param> public static void Unless(Func <bool> condition, Func <string> getExceptionMessage) { Warn.Unless(condition.Invoke(), Is.True, getExceptionMessage); }
/// <summary> /// Asserts that the code represented by a delegate throws an exception /// that satisfies the constraint provided. /// </summary> /// <param name="code">A TestDelegate to be executed</param> /// <param name="constraint">A Constraint expression to be applied</param> public static void Unless(TestDelegate code, IResolveConstraint constraint) { Warn.Unless((object)code, constraint); }
/// <summary> /// Asserts that a condition is true. If the condition is false the method throws /// an <see cref="InconclusiveException"/>. /// </summary> /// <param name="condition">A lambda that returns a Boolean</param> public static void Unless(Func <bool> condition) { Warn.Unless(condition.Invoke(), Is.True, null, null); }
/// <summary> /// Asserts that a condition is true. If the condition is false the method throws /// an <see cref="InconclusiveException"/>. /// </summary> /// <param name="condition">A lambda that returns a Boolean</param> /// <param name="message">The message to display if the condition is false</param> /// <param name="args">Arguments to be used in formatting the message</param> public static void Unless(Func <bool> condition, string message, params object[] args) { Warn.Unless(condition.Invoke(), Is.True, message, args); }
/// <summary> /// Asserts that a condition is true. If the condition is false a warning is issued. /// </summary> /// <param name="condition">The evaluated condition</param> /// <param name="getExceptionMessage">A function to build the message included with the Exception</param> public static void Unless(bool condition, Func <string> getExceptionMessage) { Warn.Unless(condition, Is.True, getExceptionMessage); }
/// <summary> /// Asserts that a condition is true. If the condition is false a warning is issued. /// </summary> /// <param name="condition">The evaluated condition</param> public static void Unless(bool condition) { Warn.Unless(condition, Is.True, null, null); }
/// <summary> /// Asserts that a condition is true. If the condition is false a warning is issued. /// </summary> /// <param name="condition">The evaluated condition</param> /// <param name="message">The message to display if the condition is false</param> /// <param name="args">Arguments to be used in formatting the message</param> public static void Unless(bool condition, string message, params object[] args) { Warn.Unless(condition, Is.True, message, args); }