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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:07:47+00:00 2026-05-10T21:07:47+00:00

So, I’m reasonably new to both unit testing and mocking in C# and .NET;

  • 0

So, I’m reasonably new to both unit testing and mocking in C# and .NET; I’m using xUnit.net and Rhino Mocks respectively. I’m a convert, and I’m focussing on writing behaviour specifications, I guess, instead of being purely TDD. Bah, semantics; I want an automated safety net to work above, essentially.

A thought struck me though. I get programming against interfaces, and the benefits as far as breaking apart dependencies goes there. Sold. However, in my behaviour verification suite (aka unit tests 😉 ), I’m asserting behaviour one interface at a time. As in, one implementation of an interface at a time, with all of its dependencies mocked out and expectations set up.

The approach seems to be that if we verify that a class behaves as it should against its collaborating dependencies, and in turn relies on each of those collaborating dependencies to have signed that same quality contract, we’re golden. Seems reasonable enough.

Back to the thought, though. Is there any value in semi-integration tests, where a test-fixture is asserting against a unit of concrete implementations that are wired together, and we’re testing its internal behaviour against mocked dependencies? I just re-read that and I think I could probably have worded it better. Obviously, there’s going to be a certain amount of ‘well, if it adds value for you, keep doing it’, I suppose – but has anyone else thought about doing that, and reaped benefits from it outweighing the costs?

  • 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-10T21:07:47+00:00Added an answer on May 10, 2026 at 9:07 pm

    Your question has been debated for years and can also be rephrased as ‘what is a unit’?

    There is no law of unit testing that says you need to test each class in isolation. However, to be maintainable, your really want tests to only have to change when the behavior they test changes. Looked at it this way it is often reasonable to use concrete versions of close collaborators and fakes for more distant ones.

    The one place I absolutely use fakes of one kind or another is to follow Michael Feather’s Rules of Unit Testing.

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

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • 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
  • added an answer Try this: '(?:[^\\']+|\\.)*' This regular expression matches a double quote… May 11, 2026 at 12:11 pm
  • added an answer No, Jython is not a suitable replacement for Java. Consider,… May 11, 2026 at 12:11 pm
  • added an answer It was a problem with the indexes. Rebuilding them solved… May 11, 2026 at 12:11 pm

Related Questions

So, I've read that it is not a good idea to install VS2008 on
So I am writing a registration form and I need the display name to
So, I know that try/catch does add some overhead and therefore isn't a good
So, I am seeing a curious problem. If I have a function // counter
So, I am a total beginner in any kind of Windows related programming. I
So, I have 2 database instances, one is for development in general, another was
So, I have willfully kept myself a Java n00b until recently, and my first
So, I am kinda new to ASP.net development still, and I already don't like
so, I'm running Apache on my laptop. If I go to localhost, I get
So, I've been reading through and it appears that the Boost libraries get used

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.