Unit Testing ASP.net Web Site Project code stored in App_Code

后端 未结 8 1792
陌清茗
陌清茗 2020-12-01 01:43

I have an ASP.net Web Site Project (.net 3.5). Currently all of the non-code behind code files (including Linq2Sql stuff, data contexts, business logic, extension methods, e

8条回答
  •  青春惊慌失措
    2020-12-01 02:21

    We have this issue at my company (My boss doesn't like DLLs, some rubbish about versioning...)

    We have two ways round it that we use frequently:

    1) Get the CI tool to do the unit testing: We use TeamCity which has a pretty tight NUnit integration, and our solution builds quick enough (and has few enough tests) for this to be a valid option.

    2) Manually precompile and unit test the resulting binaries: It's perfectly possible to run the ASP.net compiler / MSBuild from the command line (as if you were doing a 'Publish' build) and just unit test the resulting binaries.

    However, if you have the option of segregating the code into binaries (class libraries) or just using a web application, I'd suggest that as a better alternative.

提交回复
热议问题