Often in a project, you have code which runs when the application starts (such as in Program.cs or in your Global.asax file) which will set up all of your shared resources for the rest of the project, such as initializing global variables, configuring the BLL, connecting to a datasource etc.
As mentioned above, their are places to put this code provided for you.
When you are working within a unit test project you can also have some initialization code run when you run the tests. To do this, you create a test class with a static method and decorate it with the 'AssemblyInitializeAttribute'.
I usually create a class called 'InitTestEnv.cs' which consists of something like the following:
public static class InitTestEnv
public static void Initialize(TestContext context)
//configure the BLL
BLL.Configuration.EnableCaching = false;
//connect it to a datasource
Normally, I would reference the ConfigurationManager classes and then share my 'connectionStrings.config' and 'appSettings.config' files from my UI layer to keep the tests in sync with the settings that will be deployed, but in the above example I have left this out.