Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1191 from adam-knights/throws-use-params-overloads
Add new Throws overloads that allow arguments to be passed to it
- Loading branch information
Showing
14 changed files
with
1,217 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD, and Contributors. | ||
// All rights reserved. Licensed under the BSD 3-Clause License; see License.txt. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace Moq.Behaviors | ||
{ | ||
internal sealed class ThrowComputedException : Behavior | ||
{ | ||
private readonly Func<IInvocation, Exception> exceptionFactory; | ||
|
||
public ThrowComputedException(Func<IInvocation, Exception> exceptionFactory) | ||
{ | ||
Debug.Assert(exceptionFactory != null); | ||
|
||
this.exceptionFactory = exceptionFactory; | ||
} | ||
|
||
public override void Execute(Invocation invocation) | ||
{ | ||
throw this.exceptionFactory.Invoke(invocation); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.