Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:00:20+00:00 2026-06-12T17:00:20+00:00

WCF/C# N-Tier app. We have implemented Paging in our business Layer using this snippet

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:00:22+00:00Added an answer on June 12, 2026 at 5:00 pm

    I would inject your pager as something like:

      public interface IPager {
         int PageSize {get;}
      }
    

    Your concrete class would then be something simple like:

      internal class ConfigPager : IPager {
         public int PageSize {
             get{
    
                 int pageSize = 10;  // default value
                 Int32.TryParse(ConfigurationManager.AppSettings["PageSize"], out pageSize);
                 return pageSize;
             }
         }
      }
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic 3 tier app Presentation/Web (ASP.NET MVC) Application Services (WCF, hosted
I've implemented WCF service using Entity Framework in a 3-Tier solution. I got it
We have a typical multi-tier/layer architecture. Application + WCF Service + Repository/EF4/Database. We are
I have a 3-tier web application using MVC - WCF - MSSQL . I
Our WCF service has just one method: [ServiceContract(Name = Service, Namespace = http://myservice/)] [ServiceKnownType(GetServiceKnownTypes,
I have inherited a conventional three tier web app with ASP.net 2.0 for the
I've got a local app, consisting of a windows service providing the middle/business tier
I'm creating a web application using asp.net & WCF as 3 tier architecture, which
Please advise me on this. I have both Wcf service (which will be responsible
We have a 3 tier application - winform based thick client, several WCF services

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.