Your method does two things:
1) Runs the LINQ query on the IRepository<Package>
2) Calls the Package.Set() method
For #1, I would create a stub IRepository<Package> and stub the
GetQuery() method to return a set of data that will "exercise" your
LINQ query. In other words, make sure it returns data that will test
both true and false for your Where() condition. And don't forget to
test the possibility that there are no matches and you return null
(these would all be separate tests).
For #2, you have a couple of options. If you can create a mock of
"Package" (if it's a property, it must be virtual), you can verify
that the "Set" method was called with the particular package that you
expected your LINQ query to return. If Package is NOT virtual and you
can't change it, then your test would have to do some kind of
verification after Execute(int PackageID) was called to make a guess
that "Set" was called (perhaps by checking other properties).
Hope this helps.
---
Patrick Steele
http://weblogs.asp.net/psteele
> --
> You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group.
> To post to this group, send email to rhino...@googlegroups.com.
> To unsubscribe from this group, send email to rhinomocks+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
>