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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:39:20+00:00 2026-06-10T02:39:20+00:00

I have a class library that interacts with a WCF service, and uses an

  • 0

I have a class library that interacts with a WCF service, and uses an app.config file for its configuration. I’d like to unit test this class, but when I run my unit test, I get:

Could not find default endpoint element that references contract ‘FooService’ in the service model client configuaration section. This might be because no configuration file was found for your application or because no end point element matching this contract could be found in the client element

According to this answer, I need the app.config file to reside within my unit test project, and indeed this solves the problem. But I really don’t want to have to copy my app.config file around to unit tests every time I change it.

I suppose I could add a link to the app.config, except that I’m using SlowCheetah to handle app.config transformations, so my app.config is generated at compile time.

Is there anything I can do to get this to work, or do I just have to give up on my app.config and handle the configuration in code?

  • 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-10T02:39:22+00:00Added an answer on June 10, 2026 at 2:39 am

    You can mock the WCF service in your tests. You can inject a version of the the service that doesn’t use a WCF service when you are unit testing the class. This way, when the tests run, they don’t need to worry about any configuration files. This is also going to lead to a better tests. Presumably you want to test your code, not the WCF service itself. It’s better to mock it’s behaviour in your tests so you can test only your code.

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

Sidebar

Related Questions

I have a class library that has settings within an app.config. I know that
I have created a class library that should connect to a WCF endpoint project
My Scenario I have a class library that is going to be called from
I have a signed class library that I want to create assemblies for via
I have a DAL class library that is included in my program as a
I have a class library project that references the version 4.1 Microsoft.Practices.Common dll. I
I have a class, which is part of a code library project that was
Hey we have a library class (lib/Mixpanel) that calls delayed job as follows: class
I have a Visual Studio 2010 solution that contains a class library (ProjectA) and
Let's say I have a project that is a class library. I have a

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.