My take on this is as follows:

You don't need to test the LINQ query. What you actually need to test
is the behaviour of the thing you are building. We can take it as read
that LINQ has been thoroughly tested by Microsoft and it does exactly
what it should do how it should do it.

So then the question becomes .... what am I actually trying to test?

Given that I have a thing for executing
When we invoke Execute passing in the id of a known registered package
Then Package should reference the registered Package

Job done ... if the test passes, your LINQ query is correct if it
fails, it is wrong :o)


On Jan 20, 5:01 am, Laksh <[email protected]> wrote:
> I'm using 3.6 version of Rhino. How do i test the following funtion
> which has LINQ query
>
> protected override void Execute(int PackageID)
>         {
>
>             // get the package hierarchy from the database
>             IRepository<Package> repository =
> DefaultServiceLocator.Instance.GetInstance<IRepository<Package>>();
>             var package = repository.GetQuery()
>                 .Where(a => a.PackageID == PackageID)
>                 .Include(a => a.PackageDetails.Select(b =>
> b.DocumentTemplate))
>                 .Include(a => a.PackageArea)
>                 .Include(a => a.ReturnDetails)
>                 .FirstOrDefault();
>
>                  this.Package.Set(package);
>         }

-- 
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