Udostępnij za pośrednictwem


ASP.NET and Unit Tests

I was onsite the other day and the customer wanted to use Visual Studio 2005 to auto generate the Unit Test stubs for their ASP.NET application.  They have a lot of rules tied up in the ASP.NET application project.  When we tried to generate the Unit tests we kept getting the following error:

Source Code cannot be sufficiently parsed for code generation.  Please try to compile your project and fix any issues.

Well, needless to say the project compiled fine (and had been for a while) and ran fine.  We could not find any issues to fix.  My first thought was that this was a limitation because of the way they created their ASP.NET project.  So we got some details:

  1. Originally Created in VS.NET 2003
  2. Migrated to VS 2005
  3. They did not convert to the new Page Model with App_Code and such.

After doing some digging I found out that the Unit Test Generation for some reason expects that the project has at least an empty "Settings."  So we opened the properties on the project and clicked Settings.  Sure enough there was nothing there.  So we clicked the link to create the "Settings" and got the grid that would enable us to add settings.  We just left it blank and rebuilt.  At that point we retried the generation of the Unit Tests and everything went smoothly.

Thanks,
Zach

Comments