Example #1
0
 /// <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);
 }
Example #2
0
 /// <summary>
 /// Asserts that a condition is false. If the condition is true a warning is issued.
 /// </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 If(Func <bool> condition, Func <string> getExceptionMessage)
 {
     Warn.If(condition.Invoke(), Is.True, getExceptionMessage);
 }
Example #3
0
 /// <summary>
 /// Apply a constraint to an actual value, succeeding if the constraint
 /// fails and issuing a warning if it succeeds.
 /// </summary>
 /// <typeparam name="TActual">The Type being compared.</typeparam>
 /// <param name="actual">The actual value to test</param>
 /// <param name="expression">A Constraint to be applied</param>
 public static void If <TActual>(TActual actual, IResolveConstraint expression)
 {
     Warn.If(actual, expression, null, null);
 }
Example #4
0
 /// <summary>
 /// Asserts that a condition is false. If the condition is true a warning is issued.
 /// </summary>
 /// <param name="condition">A lambda that returns a Boolean</param>
 /// <param name="message">The message to display if the condition is true</param>
 /// <param name="args">Arguments to be used in formatting the message</param>
 public static void If(Func <bool> condition, string message, params object[] args)
 {
     Warn.If(condition.Invoke(), Is.True, message, args);
 }
Example #5
0
 /// <summary>
 /// Asserts that a condition is false. If the condition is true a warning is issued.
 /// </summary>
 /// <param name="condition">A lambda that returns a Boolean</param>
 public static void If(Func <bool> condition)
 {
     Warn.If(condition.Invoke(), Is.True, null, null);
 }
Example #6
0
 /// <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 If(bool condition)
 {
     Warn.If(condition, Is.True, null, null);
 }
Example #7
0
 /// <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 If(bool condition, Func <string> getExceptionMessage)
 {
     Warn.If(condition, Is.True, getExceptionMessage);
 }
Example #8
0
 /// <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 ThrowsConstraint used in the test</param>
 public static void Unless(TestDelegate code, IResolveConstraint constraint)
 {
     Warn.Unless((object)code, constraint);
 }
Example #9
0
 /// <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 If(bool condition, string message, params object[] args)
 {
     Warn.If(condition, Is.True, message, args);
 }
Example #10
0
 /// <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);
 }
Example #11
0
 /// <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);
 }
Example #12
0
 public static void Unless(Func <bool> condition, string?message, params object?[]?args)
 {
     Warn.Unless(condition.Invoke(), Is.True, message, args);
 }
Example #13
0
 public static void Unless(bool condition, Func <string?> getExceptionMessage)
 {
     Warn.Unless(condition, Is.True, getExceptionMessage);
 }
Example #14
0
 public static void Unless(bool condition, string?message, params object?[]?args)
 {
     Warn.Unless(condition, Is.True, message, args);
 }