title: Mocking View with RhinoMocks
body: <p>We are using MVP (Supervising Controller) for ASP.NET WebForms with 3.5 SP1.</p>
  
  <p>What is the preferred way to check the value of a view property that only has the a set operation with RhinoMocks?</p>
  
  <p>Here is what we have so far:</p>
  
  <pre><code>var service = MockRepository.GenerateStub&lt;IFooService&gt;();
  // stub some data for the method used in OnLoad in the presenter
  
  var view = MockRepository.GenerateMock&lt;IFooView&gt;();
  var presenter = new FooPresenter(view, service);
  
  view.Raise(v =&gt; v.Load += null, this, EventArgs.Empty);
  
  Assert.IsTrue(view.Bars.Count == 10); // there is no get on Bars
  </code></pre>
  
  <p>Should we use Expects or another way, any input would be great.</p>
  
  <p>Thanks</p>
  
  <p><strong><em>Update based on Darin Dimitrov's reply.</em></strong></p>
  
  <pre><code>var bars = new List&lt;Bar&gt;() { new Bar() { BarId = 1 } };
  
  var fooService = MockRepository.GenerateStub&lt;IFooService&gt;();
  
  // this is called in OnLoad in the Presenter
  fooService.Stub(x =&gt; x.GetBars()).Return(bars);
  
  var view = MockRepository.GenerateMock&lt;IFooView&gt;();
  var presenter = new FooPresenter(view, fooService);
  
  view.Raise(v =&gt; v.Load += null, this, EventArgs.Empty);
  view.AssertWasCalled(x =&gt; x.Bars = bars); // this does not pass
  </code></pre>
  
  <p>This doesn't work.  Should I be testing it this way or is there a better way?</p>