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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:00:00+00:00 2026-06-10T06:00:00+00:00

For my ned to end testing it is important that my testassembly does not

  • 0

For my ned to end testing it is important that my testassembly does not preload a shadowcopy of a dependent assembly.

Assembly T is the Testframework that loads and tests Assembly A.
Assembly A depends on interfaces defined in B.

For testing purposes i have to replace some static members in A without having them available during buildtime.

Here is some pseudo code that illustrates the dilemma i am in:

        A_assembly = Assembly.LoadFrom("A.dll");
        A_type = A_assembly.GetType("TheSingleton.Master", true);
        MethodInfo Master_Init_Info = type.GetMethod("Init", BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
        //before init is called some things need to be replaced
        FieldInfo semiknown = A_type.GetField("needsmocking", BindingFlags.Public | BindingFlags.Static));
        ??? mock_semiknown = MockRepository.GenerateMock<???>();
        semiknown.SetValue((???)mock_semiknown, mock_semiknown);
        //testing makes only sense if that static is replaced.
        Master_Init_Info.Invoke(null, null);
  1. I can access the type via semiknown.FieldType but what good does
    that do me? Can i use that information somehow to create the mock
    and replace the static member with it?
  2. Suppose i get the type and am able to replace the static member –
    how can i build my expectancies in the mock?
  • 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-10T06:00:01+00:00Added an answer on June 10, 2026 at 6:00 am

    You can call it by reflection

    var method = typeof(MockRepository).GetMethod("GenerateMock").MakeGenericMethod(semiknown.FieldType);
    var mock_semiknown = method.Invoke(null, null);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some values in a dataframe called 'values' ie: Sam Ned Ted Ann
I have the following code var dbvalue = Ned; var deleteLink = '<a href=#delete
I have th following method. Before returning the result I ned to have the
I got a stored procedure that delivers a table of students, and it needs
I ned to implement the multi-linear regression in C#(3.0) by using the LinESt function
scope issue in PHP classes: Why does this work? class index extends Application {
I am trying to make it so that mp3's on my site are downloaded
SQL 2000 The NED table has a foreign key to the SIGN table NED.RowID
I have noticed that, from Google Maps page, you can get an embed link
Hi I have a table in my rails app that doesnt have any id

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.