mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 12:42:32 +00:00
🔥 AssertEx.Throws
This commit is contained in:
@@ -23,23 +23,6 @@ namespace Octokit.Tests.Helpers
|
||||
return attribute;
|
||||
}
|
||||
|
||||
[Obsolete("This was written before the support for testing asynchronous tasks was added in xUnit 2.0 (because we pre-dated it). Use Assert.ThrowsAsync")]
|
||||
public async static Task<T> Throws<T>(Func<Task> testCode) where T : Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
await testCode();
|
||||
Assert.Throws<T>(() => { }); // Use xUnit's default behavior.
|
||||
}
|
||||
catch (T exception)
|
||||
{
|
||||
return exception;
|
||||
}
|
||||
// We should never reach this line. It's here because the compiler doesn't know that
|
||||
// Assert.Throws above will always throw.
|
||||
return null;
|
||||
}
|
||||
|
||||
static readonly string[] whitespaceArguments = { " ", "\t", "\n", "\n\r", " " };
|
||||
|
||||
public static async Task ThrowsWhenGivenWhitespaceArgument(Func<string, Task> action)
|
||||
|
||||
Reference in New Issue
Block a user