Going Deep

Wes Dyer and Jeffrey Van Gogh: Rx Virtual Time

Download this episode

Download Video

Description

The latest release of Rx includes new tools for testing reactive programs as well as virtual scheduling. In this video, Jeffrey and Wes discuss virtual time and virtual schedulers and how they can be used to write tests and query historical data.

What is virtual time, exactly? What purpose does it serve and how is it related to reality? Wait a century-second. What time is it? When?

As usual, Wes and Jeff go deep. Dive in with us. This is heady stuff and also really useful for practical programming with Rx. It's always great to spend some time with Wes and Jeff at the whiteboard and at the computer (they demo this for us towards the end of the session).

Enjoy!

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • N2Cheval

      Just like any other co-ordinate system can the virtual time convert to decimal, binary time or 13 month year time system? Covariance and contra-variance over time; nice. Where to plug-in the landmarks? At the extension points?

    • Flatliner

      Awesome, finally understand how Scheduler.Now is used, when I first saw that in Rx I knew you guys were using (or planning on using) virtual time but there seemed to be no documentation anywhere on the subject. Thanks for the explanation guys, extremely useful. Eagerly waiting on your unit tests so that I can start writing my asynchronous unit tests like that!

      I just realised I can write unit tests that simulate "hot" observables that I don't normally have control over i.e. mouse moves  etc, I can replace the original source with a mock observable that raises events a pre-determined times and pushes them through a virtual scheduler. Excellent!

    • contextfree`

      I was hoping for a tutorial or video on the scheduling aspects of Rx because they remained a mystery for me, so thanks. Please do release the test code!

    • exoteric

      Thanks for sharing! I've still not spent the time with Rx I've been meaning to. :-/

    • J.Van.Gogh

      @N2Cheval,

       

      you would create a scheduler that derives from VirtualScheduler, give it two type parameters that implement the absolute and relative part of your notion of time. For this to work, your notion of time will need to be able to :

      • Convert your notion of absolute time to DateTimeOffset
      • Convert TimeSpan to your notion of relative time
      • Increment your notion of absolute time with your notion of relative time to produce a new instance of your notion of absolute time.

    • J.Van.Gogh

      http://blogs.msdn.com/b/jeffva/archive/2010/08/27/testing-rx.aspx contains sample code, that hopefully will give you a headstart. We're  working on getting our tests shipping as well, but will take a bit more time..

       

       

    • mayerber

      getting "Do you want to download this file" prompt (IE) when clicking "Play" to watch the video...

       

       

      nevermind - working now.

    • RainerHilmer

      Great stuff, thanks a lot.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.