Task.Delay Challenge Solution

Friday, April 21, 2017

Task.Delay Challenge Solution This post suggest solution to the Task.Delay challenge. If you haven’t read the Task.Delay challenge you can find it here. In nutshell the challenge was about making Task.Delay like functionality which is test-able (using IScheduler for having virtual time). In order to support virtual time I will use Rx’s stream (which is also awaitable). The original Task.Delay is actually having 2 different completion path: - Complete by time. - Complete as result of cancellation token event. The general idea of the solution is to have 2 Rx’s streams one for each completion path: - Timer...
no comments

RX Issue: scheduler within Merge over GroupBy

Wednesday, May 4, 2016

Be aware of RX issue when you use scheduler within Merge over GroupBy The following code snippets work well when no scheduler is used: Code Snippet var source = Observable.Return(1)                         .Concat(Observable.Never<int>());   var xs = from item in source             group item by item % 3 == 0 into g             from x in Observable.Merge(                 g.FirstOrDefaultAsync(),                 g.LastOrDefaultAsync())             select x;   xs.Subscribe(Console.WriteLine); The code snippet will produce output of 1   When altering the code for better testability and adding scheduler to the Return and Merge operation, it will produce no output. ...
no comments