It looks like you should pass the LoadController into the LoadHandler, so that 
you can provide a substitute implementation. Then glue everything together at a 
higher level.

S.

On 11 Nov 2009, at 19:48, joshlrogers wrote:
> I am able to mock the handler class, but because I intercept the calls
> to the methods and return just what I say it doesn't test the logic of
> the handler class itself.  This handler class has instantiations of
> the data access objects and those are what I am trying to mock.  For
> instance a contrived example would be:
> 
> public class LoadHandler: ILoadHandler
> {
> 
>  private ILoadController _LoadController;
>  private DataTable _LoadTable;
> 
>   public LoadHandler()
>   {
>     _LoadController = _Resolver.Resolve<ILoadController>();
>   }
> 
>  public object FillLoadTableAndDoSomethingSpiffy()
>  {
>    _LoadTable = _LoadController.GetLoads();
>    ...proceed on to doing something spiffy and return a value...
>  }
> 
> }
> 
> So I want to write a unit test to make sure that
> FillLoadTableAndDoSomethingSpiffy returns the expected value, however
> I don't want the LoadController to actually read from the DB, that is
> the part I want to mock so that I can control what that returns.


Steve Freeman
http://www.mockobjects.com
http://www.growing-object-oriented-software.com

Winner of the Agile Alliance Gordon Pask award 2006





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to