Master time with Reactive Extensions

added by Paul Wheeler
3/17/2014 1:10:48 PM

2 Kicks, 77 Views

Writing tests of asynchronous code can be very tricky. You often have to resort to calling Thread.Sleep or Task.Delay within an asynchronous callback so you can control the timing and assert what you need to assert. For the most part, these are ugly hacks. What you really want is a way to control execution timing with fine grained control. Here's the good news. When you use Reactive Extensions (Rx), you have such a device at your disposal!