Unit Testing Asynchronous Code

Unit Testing Asynchronous methods in older days were pretty tough, but thanks to the advances made in the Unit Testing Frameworks, this is now all the more easier. We will begin by writing an async method, which we could use for writing our Unit Tests against. The advancements in Unit Testing Framework has made it … Continue reading Unit Testing Asynchronous Code

WaitForFirstN Tasks Method

There is a definite gap between TAP Utilities Task.WaitAny and Task.WaitAll. How do we wait for the first 'N' tasks from an array of tasks. That is one utility that is missing from TAP's rich repository. It might not be hard to implement one by yourself though. The above code uses existing Task Collaborators Task.WaitAny … Continue reading WaitForFirstN Tasks Method

Switching Context With Async

Whenever an await is encountered in the code, a context is captured, which is later used when the promise is completed and ready to continue. If the method is called by the UI thread, usually, the context could be UI context, unless the awaited method itself creates a new thread. This can be demonstrated in … Continue reading Switching Context With Async