Skip to content

Commit

Permalink
Allow chaining for SatisfyRespectively assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
ishimko committed May 7, 2019
1 parent 7d18003 commit 10e43e9
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ public void AllBeEquivalentTo<TExpectation>(TExpectation expectation,
/// The element inspectors, which inspect each element in turn. The
/// total number of element inspectors must exactly match the number of elements in the collection.
/// </param>
public void SatisfyRespectively(params Action<T>[] elementInspectors)
public AndConstraint<GenericCollectionAssertions<T>> SatisfyRespectively(params Action<T>[] elementInspectors)
{
SatisfyRespectively(elementInspectors, string.Empty);
return SatisfyRespectively(elementInspectors, string.Empty);
}

/// <summary>
Expand All @@ -377,7 +377,7 @@ public void SatisfyRespectively(params Action<T>[] elementInspectors)
/// <param name="becauseArgs">
/// Zero or more objects to format using the placeholders in <see cref="because" />.
/// </param>
public void SatisfyRespectively(IEnumerable<Action<T>> expected, string because = "", params object[] becauseArgs)
public AndConstraint<GenericCollectionAssertions<T>> SatisfyRespectively(IEnumerable<Action<T>> expected, string because = "", params object[] becauseArgs)
{
if (expected is null)
{
Expand Down Expand Up @@ -420,6 +420,8 @@ public void SatisfyRespectively(IEnumerable<Action<T>> expected, string because
.BecauseOf(because, becauseArgs)
.FailWith(failureMessage);
}

return new AndConstraint<GenericCollectionAssertions<T>>(this);
}

private string[] CollectFailuresFromInspectors(IEnumerable<Action<T>> elementInspectors)
Expand Down

0 comments on commit 10e43e9

Please sign in to comment.