Sto provando a eseguire un test su NUnit3 e sto ottenendo un System.ArgumentException: i metodi 'async void' non sono supportati, per favore usa invece 'async Task'.NUnit3: Assert.Throws con async Compito
[Test]
public void InvalidUsername()
{
...
var exception = Assert.Throws<HttpResponseException>(async() => await client.LoginAsync("[email protected]", testpassword));
exception.HttpResponseMessage.StatusCode.ShouldEqual(HttpStatusCode.BadRequest); // according to http://tools.ietf.org/html/rfc6749#section-5.2
...
}
Assert.Throws sembra prendere una TestDelegate, definita come:
public delegate void TestDelegate();
quindi l'ArgumentException. Qual è il modo migliore per effettuare il porting di questo codice?
Correlati: http://stackoverflow.com/questions/15634542/nunit-async-test-exception-assertion –