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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:34:41+00:00 2026-05-13T05:34:41+00:00

I have an object the references a bunch of Properties.Settings.Default… values and I need

  • 0

I have an object the references a bunch of Properties.Settings.Default... values and I need to stub these in the unit test for this object.

Unfortunately the type for the settings object is declared as internal and so I can’t access it from the unit test project.

How can I stub up the return values for these properties? I’m using Rhino Mocks for mocking.

  • 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-13T05:34:42+00:00Added an answer on May 13, 2026 at 5:34 am

    In general, I wouldn’t. Instead of your “inner” objects actually reading Properties.Settings.Default, have them declare a cconfigurable property (either at construction time, or via properties), and have another piece of code populate them.

    That way, you can test everything but the default reading stuff in your unit tests, and you become less coupled to a way of reading the defaults, making it easier to switch the mechanism in the future.

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

Sidebar

Related Questions

I have this Linked Web(?) data structure ie. each object has a bunch of
I have my main class PayUnit where I create my main object references, such
When I have an object, removing all references to it is enough to sign
In the ADO.Net Entity Framework, I have an object which has 4 references to
I have a object Organization Unit and I have a self reference to it
If I have a reference to an object: var test = {}; that will
I have two objects (instances of the same class) with a bunch of properties,
I have a Browser Helper Object project in c# that (obviously) references shdocvw.dll. I
In a bunch o' places in my code, I have something like this: public
Hopefully this is an easy one for someone. Basically I have a bunch of

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.