Global.asax.cs and unittests

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

I have a problem where the code in Global.asax.cs runs before the unittests
(on test of course).

In the global file, i load some data from a Oracle table and save it in
HttpApplicationState. This is happening in the Application_start function.

The following unittest show the beginning of the method, where the database
mock is created. If this mock isn't created, the unittest will try to access
the database - which is not allowed/possible from the build server.

[TestMethod()]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost("C:\...Web", "/")]
[UrlToTest("http://localhost:2044/";)]
[DeploymentItem("...Web.dll")]
public void PageTest()
{
DatabaseAccess.CreateDataAccessMock();
//the test code

}

The problem is that i want the mock to be created before the Global.asax.cs
file is called.
Is that possible ??

Thank you in advance.

BR
Peter


.