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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:46:29+00:00 2026-05-16T15:46:29+00:00

The title says it – What happens between TestMethods in MS Visual Studio Unit

  • 0

The title says it – What happens between TestMethods in MS Visual Studio Unit Tests?

I have a bunch of TestMethods in a TestClass that has a TestInitialize method.

The TestInitialize method internally loads a Type via Reflection (eg. Type.GetType("MyContainer, MyContainerAssembly") ). MyContainer is a class that inherits from WindsorContainer (from Castle Windsor).

When I choose to run all unit tests in the solution, the first time TestInitialize is called (for the first TestMethod), this works all well and good. When the second TestMethod executes and TestInitialize is called, my Type.GetType call returns null.

I put a breakpoint inside the TestInitialize method and verified this. To debug the issue, I tried in the Immediate Window:

Assembly.Load("MyContainerAssembly")

which worked…then:

Assembly.Load("MyContainerAssembly").GetTypes()

and what do you know? It threw a TypeLoaderException saying that it couldn’t find the assembly Castle.Windsor. Checked the bin\debug directory for the Unit Test project. It’s there.

So then I tried:
Assembly.Load(“Castle.Windsor”)

which worked…then:

Assembly.Load("Castle.Windsor").GetAssemblies()

…could not load Castle.Core…so then

Assembly.Load("Castle.Core")

then

Type.GetType("MyContainer, MyContainerAssembly")

again…and it returned the Type instance, not null.

Thoughts?

  • 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-16T15:46:30+00:00Added an answer on May 16, 2026 at 3:46 pm

    Visual Studio does not run the tests in the bin\Debug output folder. Instead, it has a separate TestResults folder where it makes a new subfolder and copies assemblies for each test run. (This folder appears in the same folder as the solution file.) The assemblies you mention are probably not being copied.

    You can add files via test run configurations: Open the Test menu, “Edit Test Run Configurations”, choose a test configuration to edit, and select the “Deployment” view. Here you can add any extra files that need to be deployed.

    Alternatively, you can use the DeploymentItem attribute on your tests.

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

Sidebar

Related Questions

The title says everything. I'm using Visual Studio Team System 2008 Database Edition and
Title says most of it. I have a div container that holds all the
Title says all. I'll have navigation that looks like this and it's dynamically created
As title says, I have a list of words, Like stopWords = [the, and,
As title says, i know that new throws an exception which can be caught,
As title says, I have access to the current listitem - and it's easy
The title says it mostly. If I have an object in Python and want
The title says it! I know that Jon Skeet was working on an implementation
The title says enough I think. I have a full quality BufferedImage and I
As title says, im having trouble with my junit tests passing for checking if

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.