5
votes

I am creating one web application which has structure as shown in following image:

Structure

I have all entities and datastore files in the App_Code folder. i.e no separate project layer is created. I want to use Nunit for unit testing. But as for NUnit testing I need projectname.dll and my web application will not create dll I don't know how to test my methods.

If I create a separate project for unit tests, I can not reference datastore and other files in that project. Kindly suggest how can I use Nunit in this case.

1
you should create web application, rather than website: stackoverflow.com/questions/398037/…cuongle
I can not do it as this is existing application and I am just adding a module to it.user1181942
I dont know this is right or not, but I think I will have to create a separate project and all the time copy class files from website to project will work. This is bit frustrating. But I can see any other solutionuser1181942
@user1181942 I was going to suggest it. See my edit.Oscar Mederos

1 Answers

4
votes

Please, check this: Unit Testing ASP.net Web Site Project code stored in App_Code.

You can also create another project, just for unit testing purposes. When you create it, just include all the required files (in App_Code) As a Link. That way you will be creating shortcuts, so if you modify one file in your project, the other project you created will reflect the changes.