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 8196319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:26:22+00:00 2026-06-07T05:26:22+00:00

I work in TDD environment and basically I am facing with a dilemma which

  • 0

I work in TDD environment and basically I am facing with a dilemma which I think is very important in TDD environment. As a programmer, you want your methods to be as readable as possible. To achieve that, we tend to partition our methods in multiple private methods as well. While doing that all that code which was moved to the private function looses it’s test ability.

Rhino test class cannot see all those private methods and I need to be able to run tests against those methods as well. I do not want them to be public because it does not make sense to keep them public.

Any ideas?

  • 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-07T05:26:24+00:00Added an answer on June 7, 2026 at 5:26 am

    If I qoute a part of your question:

    […] we tend to partition our methods in multiple private methods […]

    This is wrong. If you follow a single responsibility principle and good OOP design, your methods would be much independent and simpler. If you feel like you want to extract a yet another private method to make your public one look shorter, give it a thought first. Maybe, you can refactor it in a separate class?

    You do not test private methods, because you test public contracts and not the details of implementations. If you want to have something distantly similar to private methods testing, make them internal and set InternalsVisibleTo attribute.

    Another method (pointed by R. Harvey) is to write a wrapper class that wraps you private methods into public ones. This approach has a benefit that you don’t need to make your private methods internal. The downside is that for every private method you will have a wrapper public method. So the amount of methods may double.

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

Sidebar

Related Questions

work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job
I'm interested in setting up a TDD environment for developing Vim scripts and rc
Whilst practicing some TDD at work for an ASP.Net MVC project, I ran into
I want to try to implement the Tetris Game using TDD. From what I've
I work as a lone developer in a very small company. My work is
When I work TDD I tend to start out with the big picture and
I work in an office which has been doing Agile for a while now.
We have a bug to fix, and like any good TDD practitioner, I want
I am trying to setup Agile and TDD environment for MFC applications that require
Lots of developers think that testing private methods is a bad idea. However, all

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.