title: How does the TestScheduler in Reactive Extensions v2 work
body: <p>I have been reading this: <a href="http://blogs.msdn.com/b/rxteam/archive/2012/06/14/testing-rx-queries-using-virtual-time-scheduling.aspx" rel="nofollow noreferrer">Testing Rx Queries using Virtual Time Scheduling</a></p>
  <p>I got to the part &quot;Using Unit Test projects&quot; (about halfway down the page) and tried it myself (using VS2012 &amp; MSTest) but my results are not the same as in the document. Specifically, my assertions fail.</p>
  <p>Here is my test code:</p>
  <pre class="lang-cs prettyprint-override"><code>[TestMethod]
  public void TestMethod1()
  {
      var scheduler = new TestScheduler();
  
      var xs = scheduler.CreateColdObservable(
          OnNext(10, 42),
          OnCompleted&lt;int&gt;(20));
  
      var observer1 = scheduler.CreateObserver&lt;int&gt;();
      scheduler.Schedule(TimeSpan.FromTicks(190), 
                         (s, t) =&gt; xs.Subscribe(observer1));
  
      var observer2 = scheduler.CreateObserver&lt;int&gt;();
      scheduler.Schedule(TimeSpan.FromTicks(220), 
                         (s, t) =&gt; xs.Subscribe(observer2));
  
      scheduler.Start();
  
      observer1.Messages.AssertEqual(
          OnNext(200, 42),
          OnCompleted&lt;int&gt;(210));
  
       observer2.Messages.AssertEqual(
          OnNext(230, 42),
          OnCompleted&lt;int&gt;(240));
  }
  </code></pre>
  <p>One change I had to make was this:</p>
  <pre class="lang-cs prettyprint-override"><code>scheduler.Schedule(TimeSpan.FromTicks(190),
                     () =&gt; xs.Subscribe(observer1));
  </code></pre>
  <p>became:</p>
  <pre class="lang-cs prettyprint-override"><code>scheduler.Schedule(TimeSpan.FromTicks(190), 
                     (s, t) =&gt; xs.Subscribe(observer1));
  </code></pre>
  <p>To be perfectly honest I don't grasp the impact of this change (I haven't been coding in C# that long!).</p>
  <p>And here are the results:</p>
  <pre><code>Assert.Fail failed. 
  Expected: [OnNext(42)@200, OnCompleted()@210]
  Actual..: [OnNext(42)@11, OnCompleted()@21]
  </code></pre>
  <p>The way I understand it is that I am creating a cold observable that will return the value 42 on the 10th tick and the sequence completes on the 20th tick. I then create and observer that subscribes to this observable indicating that I want the schedule to start at tick 190. Hence the test for value 42 at tick 200 (190 + 10) and the completion time at tick 210. I however get ticks 11 and 21 respectively.</p>
  <p>The document is based on a pre-RTM of V2 so I am not sure if the behavior of the TestScheduler has been changed in the RTM or whether I made a mistake somewhere. I'd appreciate if someone could explain what is happening.</p>