views:

21

answers:

1

Hi, I am working with unit testing for MVC application using visual studio's test project. I need to call Application_start() method from my TestInitialise method of unit test, as my Application_Start initialises some global values which are required for my app. I have also copied necessaty info from web.config to app.config of my test app. How can i do it?

thanks, kapil

A: 

In order to call the Application_Start method you will first need an instance of your application which is very difficult to have in a unit test. So externalize everything that you have in this method into a separate static method which you could invoke in your unit test.

Darin Dimitrov