I have following extension method written:
static public IQueryable<OutboundPattern> ByClientID(this IQueryable<OutboundPattern> qry, int clientID)
{
return from p in qry
where p.ClientID == clientID
select p;
}
I also have the following service layer method written:
public IList<OutboundPattern> OutboundPatterns(int ClientId)
{
return _outboundpatternRepository.OutboundPatterns().ByClientID(ClientId).ToList();
}
I would love to know how to mock with Rhino mocks? I know that static methods and Rhino mocks are no good together? It can not mock statics methods.
Daniel Cazzulino has a couple of blog posts that describe an approach to mocking static extension methods.
This might be more work/change than you would like to make in this case, but it’s the only way to do it that I’ve seen (besides buying TypeMock).
Here are his posts:
Making extension methods amenable to mocking
How to mock extension methods