Example #1
0
 /// <summary>
 /// Adds an additional assertion for the test.
 /// </summary>
 /// <param name="assertion">The assertion. It should have one parameter for each "Given" clause (if any), and a final one for the thrown exception.</param>
 /// <param name="description">The description of the assertion. Optional</param>
 /// <param name="assertionExpression">
 /// Automatically populated by the compiler - takes the value of the argument expression passed to the assertion parameter.
 /// Used as the description of the assertion if no description is provided - after a little processing (namely, lambda expressions are trimmed so that only their body remains).
 /// </param>
 /// <returns>A builder for providing additional assertions for the test.</returns>
 public ActionTestBuilderWithExAssertions And(
     Action <Exception> assertion,
     string description = null,
     [CallerArgumentExpression("assertion")] string assertionExpression = null)
 {
     assertions.Add(new AssertionImpl(assertion, description ?? AssertionExpressionHelpers.ToAssertionDescription(assertionExpression)));
     return(this);
 }
Example #2
0
 /// <summary>
 /// Adds an additional assertion for the test.
 /// </summary>
 /// <param name="assertion">The assertion.</param>
 /// <param name="description">The description of the assertion. Optional.</param>
 /// <param name="assertionExpression">
 /// Automatically populated by the compiler - takes the value of the argument expression passed to the assertion parameter.
 /// Used as the description of the assertion if no description is provided - after a little processing (namely, lambda expressions are trimmed so that only their body remains).
 /// </param>
 /// <returns>A builder for providing additional assertions for the test.</returns>
 public FunctionTestBuilderWithAssertions <TResult> And(
     Action <TestFunctionOutcome <TResult> > assertion,
     string description = null,
     [CallerArgumentExpression("assertion")] string assertionExpression = null)
 {
     assertions.Add(new AssertionImpl(assertion, description ?? AssertionExpressionHelpers.ToAssertionDescription(assertionExpression)));
     return(this);
 }