Async Unit Tests

If you are programming with C# 5.0 you will no doubt been making use of Async & Await which makes code work asynchronously with ease.

However, if you are trying to run Unit Tests against Async methods you will notice they are not picked up by Visual Studios runner, this is because you cannot return void for an Async method that you are trying to Unit Test, it must return the type Task.

I came across this solution on Stackoverflow.

Advertisements

Published by

Alan Feekery

Developer, Gamer, Musician, Cyclist and big Motorsport fan... enjoys the odd cup of coffee :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s