2
AsyncTestDelegate del = async() => await foo.doSomething(null);
del.ShouldThrowAsync<ArgumentNullException>();
だから私はこれを書いた:
public static async Task<T> ShouldThrowAsync<T>(this AsyncTestDelegate del) where T : Exception {
return (await Assert.ThrowsAsync(typeof(T), del)) as T;
}
しかし、それは動作しません:'Exception' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'Exception' could be found (are you missing a using directive or an assembly reference?)
。
私は間違っていますか?
ええ私はそれが代理人であったため、アサーションが待たれる必要があると自動的に仮定しました。 –
MSの命名規則に基づいて、それはあったはずです。 ;) – smoksnes