title: ReactiveUI: Testing observable properties from unit tests
body: <p>There is this <a href="http://blogs.msdn.com/b/rxteam/archive/2012/06/14/testing-rx-queries-using-virtual-time-scheduling.aspx" rel="nofollow">example</a> on the official RX blog:</p>
  
  <pre><code>var scheduler = new TestScheduler();
  
  var xs = scheduler.CreateColdObservable(
      OnNext(10, 42),
      OnCompleted&lt;int&gt;(20)
  );
  
  var res = scheduler.Start(() =&gt; xs);
  
  res.Messages.AssertEqual(
      OnNext(210, 42),            // Subscribed + 10
      OnCompleted&lt;int&gt;(220)       // Subscribed + 20
  );
  
  xs.Subscriptions.AssertEqual(
      Subscribe(200, 1000)        // [Subscribed, Disposed]
  );
  </code></pre>
  
  <p>I'd like to do something like this with reactiveui. I mean instead of the scheduler.CreateColdObservable(...) use the streams from actual property change notification. The problem is that I tried vm.ObservableForProperty and vm.Changed but they worked inconsistently (not all property change created an event or the value was null)</p>
  
  <p>Here is the code of my VM:</p>
  
  <pre><code>internal class ProductFileEditorVM : ReactiveObject
  {
      private readonly List&lt;string&gt; _preloadedList;
  
      private bool _OnlyContainingProduct;
      public bool OnlyContainingProduct
      {
          get { return _OnlyContainingProduct; }
          set
          {
              this.RaiseAndSetIfChanged(x =&gt; x.OnlyContainingProduct, value);
          }
      }
  
      private ObservableAsPropertyHelper&lt;IEnumerable&lt;string&gt;&gt; _RepoList;
      public IEnumerable&lt;string&gt; RepoList
      {
          get{return _RepoList.Value;}
      }
  
      public ProductFileEditorVM(RepositoryManager repositoryManager)
      {
  
          //Set defaults
          OnlyContainingProduct = true;
  
          //Preload
          _preloadedList = repositoryManager.GetList();
  
          var list = this.WhenAny(x =&gt; x.OnlyContainingProduct,
                       ocp =&gt;
                       ocp.Value
                           ? _preloadedRepoList.Where(repo =&gt; repo.ToLower().Contains("product"))
                           : _preloadedRepoList);
          list.ToProperty(this, x =&gt; x.RepoList);
      }
  }
  </code></pre>
  
  <p>Ideally I'd like to use Observable.CombineLatest on the two property and creating a tuple and comparing this tuple in the assert expression like in the first example.</p>
  
  <p>The good result would be:</p>
  
  <ol>
  <li>[OnlyContainingProduct==true;RepoList= the filtered one] </li>
  <li>!change OnlyContainingProduct to false</li>
  <li>[OnlyContainingProduct==false;RepoList= the whole list]</li>
  </ol>
  
  <p>*<em>Or is this the wrong way to approach it? The only example I saw about this uses actual time measures like milliseconds but I don't see how they are useful except in case of Throttle and similar methods. *</em> </p>