-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 #437 from octokit/haacked/regression-fix
Fix regression in throwing proper 2FA exception
- Loading branch information
Showing
8 changed files
with
36 additions
and
17 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
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,19 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using NSubstitute; | ||
using NSubstitute.Core; | ||
|
||
public static class NSubstituteExtensions | ||
{ | ||
public static ConfiguredCall ReturnsAsync<TTask, TTaskType>( | ||
this TTask value, Func<CallInfo, TTaskType> returnThis, | ||
params Func<CallInfo, TTaskType>[] returnThese) where TTask : Task<TTaskType> | ||
{ | ||
return value.Returns(callInfo => Task.Factory.StartNew(() => returnThis(callInfo))); | ||
} | ||
|
||
public static ConfiguredCall ThrowsAsync<T>(this Task<T> value, Exception exception) | ||
{ | ||
return value.ReturnsAsync<Task<T>, T>(callInfo => { throw exception; }); | ||
} | ||
} |
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