Skip to content

Commit

Permalink
Add XML doc comments for setup verification
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Mar 28, 2020
1 parent 37053f1 commit 6b3bf34
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/Moq/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ public override string ToString()
return builder.ToString();
}

/// <summary>
/// Verifies this setup and/or those of its inner mock (if present and known).
/// </summary>
/// <param name="predicate">
/// Specifies which setups should be verified.
/// </param>
/// <param name="error">
/// If this setup and/or any of its inner mock (if present and known) failed verification,
/// this <see langword="out"/> parameter will receive a <see cref="MockException"/> describing the verification error(s).
/// </param>
/// <returns>
/// <see langword="true"/> if verification succeeded without any errors;
/// otherwise, <see langword="false"/>.
/// </returns>
public bool TryVerify(Func<Setup, bool> predicate, out MockException error)
{
if (predicate(this))
Expand All @@ -103,6 +117,21 @@ public bool TryVerify(Func<Setup, bool> predicate, out MockException error)
return this.TryVerifyInnerMock(predicate, out error);
}

/// <summary>
/// Verifies all setups of this setup's inner mock (if present and known).
/// Multiple verification errors are aggregated into a single <see cref="MockException"/>.
/// </summary>
/// <param name="predicate">
/// Specifies which setups should be verified.
/// </param>
/// <param name="error">
/// If one or more setups of this setup's inner mock (if present and known) failed verification,
/// this <see langword="out"/> parameter will receive a <see cref="MockException"/> describing the verification error(s).
/// </param>
/// <returns>
/// <see langword="true"/> if verification succeeded without any errors;
/// otherwise, <see langword="false"/>.
/// </returns>
protected virtual bool TryVerifyInnerMock(Func<Setup, bool> predicate, out MockException error)
{
if (this.ReturnsInnerMock(out var innerMock))
Expand All @@ -118,6 +147,17 @@ protected virtual bool TryVerifyInnerMock(Func<Setup, bool> predicate, out MockE
return true;
}

/// <summary>
/// Verifies only this setup, excluding those of its inner mock (if present and known).
/// </summary>
/// <param name="error">
/// If this setup failed verification,
/// this <see langword="out"/> parameter will receive a <see cref="MockException"/> describing the verification error.
/// </param>
/// <returns>
/// <see langword="true"/> if verification succeeded without any errors;
/// otherwise, <see langword="false"/>.
/// </returns>
protected virtual bool TryVerifySelf(out MockException error)
{
error = null;
Expand Down

0 comments on commit 6b3bf34

Please sign in to comment.