I am having a little bit of trouble getting unit tests to run for code implemented in an ASP.NET application.
This is an issue when trying to create a new unit test project in Visual Studio 2012. In 2010, I remember that unit tests designed for ASP.NET were generated automatically. In other words, before running the unit tests, the unit test project would open an instance of the website and run the tests through it. This is no longer the case it seems.
To create the unit test project, I go to New Project->Unit Test Project
. It used to be that I would right click on a function and I would get Create Unit Tests...
which would create a unit test project designed for ASP.NET applications.
When I create the normal unit test project however, the code crashes on ASP.NET specific functionality. In this case I have a crash on HttpContext.Current.Trace.Write
with a NullRefereceException
Does anyone know how to resolve this issue?