mercredi 22 février 2017

NUnit doens't wait for the async task to complete

I have a very simple NUnit test which is calling an asynchronous method.

Of course the test is awaiting like it should be:

public async void Test()
{
    var controller = new Controller(mockService.Object);

    var model = new MyObject
    {
        Address = "12.12.12.12",
        Password = "123456",
        Username = "John Foo"
    };

    var res = await controller.Add(model);
}

When I run the test it doesn't wait for the Add method to complete, even if I tell it to do so (await)

Aucun commentaire:

Enregistrer un commentaire