Extend the ShouldThrow*() methods for Func<Task> too so you can work with async methods:
Func<Task> foo = async () => { await DoSthAsync(); }
foo.ShouldThrow<ArgumentNullException>();
Comments: Doesn't work in FA 2.0.1: // Act Action action = async () => await controller.GetUserInformation(userInformation); // Assert action.ShouldThrow<HttpResponseException>(); Error: Result Message: Expected System.Web.Http.HttpResponseException, but no exception was thrown. During debugging another exception is thrown. So why messages states about "no exception" ?
Func<Task> foo = async () => { await DoSthAsync(); }
foo.ShouldThrow<ArgumentNullException>();
Comments: Doesn't work in FA 2.0.1: // Act Action action = async () => await controller.GetUserInformation(userInformation); // Assert action.ShouldThrow<HttpResponseException>(); Error: Result Message: Expected System.Web.Http.HttpResponseException, but no exception was thrown. During debugging another exception is thrown. So why messages states about "no exception" ?