WCF/C# N-Tier app.
We have implemented Paging in our business Layer using this snippet as a basic guideline.
I'm just wondering- in an effort to make the paging functionality testable, should I make the pager a public property of our Manager classes or inject it in the constructor? We already inject a repository for unit testing but I do not feel it's right to go down the route of injecting too much.
Alternatively, is it better to keep the pager private? The page size will be specified in a config file anyway so I guess I could specify the page size in the test app.config.
I would inject your pager as something like:
Your concrete class would then be something simple like:
By injecting the IPager you're able to more fully test your manager class to make sure that it actually respects different settings for PageSize since you can easily mock it and test different sizes. This will call out any cases where someone might try to hard-code a page size value in your manager.