🔥 AssertEx.Throws

This commit is contained in:
Mordechai Zuber
2015-05-19 12:07:46 +03:00
parent b9b447b472
commit eed94b4dd2
-17
View File
@@ -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)