Modern unit tests frameworks support awaiting the results of an asychronous unit test, like this:
public async Task SomeTest()
{
var result = await SomeMethodAsync();
// ... Verify the result ...
}
Is there any advantage of using this async approach over simply blocking?
public void SomeTest()
{
var result = SomeMethodAsync().Result;
// ... Verify the result ...
}
Does the async only provide a benefit when running tests in parallel?
Aucun commentaire:
Enregistrer un commentaire