private IObservable <int> SumOfLast5NumbersPlusOne(IFiveNumbers fiveNumbers) { return(Observable .Interval(TimeSpan.FromMilliseconds(500), new NewThreadScheduler()) .Map(time => fiveNumbers.LastNumber) .DistinctUntilChanged() .Map(number => number + 1) .Buffer(5) .Map(numbers => numbers.Sum()) .FirstAsync()); }
public FiveNumbersController(IFiveNumbers fiveNumbers) { _fiveNumbers = fiveNumbers; }