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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:49:08+00:00 2026-05-13T22:49:08+00:00

I’m currently working on what I would call integration tests. I want to verify

  • 0

I’m currently working on what I would call integration tests. I want to verify that if a WCF service is called it will do what I expect.

Let’s take a very simple scenario. Assume we have a contract object that we can put on hold or take off hold. Now writing the put on hold test is quite simple. You create a contract instance and execute the code that puts it on code.

The question I have comes when we want to test the taking off hold service call. The problem is that putting a contract on hold can be actually quite complicated leading to various objects all be modified. So usually I would use the Builder pattern and do something like this..

var onHoldContract = new ContractBuilder().PutOnHold().Build();

The problem I have with this is now I have to pretty much replicate a large part of my put on hold service. Now when I change what putting something on hold means I have two places I have to modify.

The other option that immediately jumps out at me is to just use the put on hold service as part of my test setup but now I’m coupling my test to the success of another piece of code which is something I don’t like to do since it can lead to failures in one spot breaking unrelated tests elsewhere (if put on hold failed for example).

Any other options I’m missing out here? or opinions on which method is preferable and why?

  • 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-05-13T22:49:08+00:00Added an answer on May 13, 2026 at 10:49 pm

    The Mock framework is a good option for unit testing. But for what I understood you are actually doing integration at this stage right? So you’re calling your WCF service as a black box (from a client point of view). I’m assuming that when you’re executing your On Hold operation, you have to do some persistance on a repository (Database, XML files, etc).

    In this case then, the mock framework only at the testing side will not help you much, because in order to test the Off Hold operation, you need a On Hold object in the proper state, including repository entries etc. Seems to me that the only way to do this without having to reinvent the wheel is to use the service to put it On Hold first. But if you’re admant to decouple then, then you will need to setup the environment and this means code duplication (I actually had to do this on some integration test scenarios – what I would do was to setup it on the start of the test run).

    Notice that your unit tests would be on a lower level, in the implementation of the service itself, and there you should be decoupling it as much as possible – this is where I would be applying the Mock Framework.

    I hope this helps.

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

Sidebar

Related Questions

No related questions found

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.