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

  • Home
  • SEARCH
  • 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 60991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:14:55+00:00 2026-05-10T18:14:55+00:00

Having recently discovered this method of development, I’m finding it a rather nice methodology.

  • 0

Having recently discovered this method of development, I’m finding it a rather nice methodology. So, for my first project, I have a small DLL’s worth of code (in C#.NET, for what it’s worth), and I want to make a set of tests for this code, but I am a bit lost as to how and where to start.

I’m using NUnit, and VS 2008, any tips on what sort of classes to start with, what to write tests for, and any tips on generally how to go about moving code across to test based development would be greatly appreciated.

  • 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. 2026-05-10T18:14:55+00:00Added an answer on May 10, 2026 at 6:14 pm

    See the book Working Effectively with Legacy Code by Michael Feathers.

    In summary, it’s a lot of work to refactor existing code into testable and tested code; Sometimes it’s too much work to be practical. It depends on how large the codebase is, and how much the various classes and functions depend upon each other.

    Refactoring without tests will introduce changes in behaviour (i.e. bugs). And purists will say it’s not really refactoring because of the lack of tests to check that the behaviour doesn’t change.

    Rather than adding test across the board to your whole application at once, add tests when you work in an area of code. Most likely you’ll have to return to these ‘hotspots’ again.

    Add tests from the bottom up: test little, independent classes and functions for correctness.

    Add tests from the top down: Test whole subsystems as black boxes to see if their behaviour changes with changes in code. And so you can step through them to find out what’s going on. This approach will probably get you the most benefit.

    Don’t be too concerned at first with what the ‘correct’ behaviour is while you are adding tests, look to detect and avoid changes in behaviour. Large, untested systems often have internal behaviours that may seem incorrect, but that other parts of the system depend on.

    Think about isolating dependencies such as database, filesystem, network, so that they can be swapped out for mock data providers during testing.

    If the program doesn’t have internal interfaces, lines which define the boundary between one subsystem/layer and another, then you may have to try to introduce these, and test at them.

    Also, automatic mocking frameworks like Rhinomocks or Moq might help mock existing classes here. I haven’t really found the need for them in code designed for testability.

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

Sidebar

Ask A Question

Stats

  • Questions 140k
  • Answers 140k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try adding this near the top of the file: import… May 12, 2026 at 7:52 am
  • Editorial Team
    Editorial Team added an answer remove the "http://localhost" part of your code. As a rule… May 12, 2026 at 7:52 am
  • Editorial Team
    Editorial Team added an answer You can configure Textpad to reload the file without prompting.… May 12, 2026 at 7:52 am

Related Questions

Having recently discovered this method of development, I'm finding it a rather nice methodology.
I'm new to the Oracle Platform (having primarily used MySQL, with a little Postgres
I am building a c# winform app and the framework I inherited uses UI
Here is how our Tomcat webserver is currently setup. We are using jsp for
This question has been puzzling me for a long time now. I come from

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.