且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

单元测试ASP.NET遗产code

更新时间:2023-02-16 23:19:31

在单元测试遗留ASP.NET code,一些最困难的挑战是在嘲讽出的东西,如会议,HTTP上下文和页面对象。为了隔离这些,你最终不得不非常杂乱嘲讽逻辑,这通常涉及到很多的反射和运行时间值的注入。

When unit testing legacy ASP.NET code, some of the hardest challenges are in mocking out stuff like the Session, HTTP Context and the Page Object. To isolate these you end up having very messy mocking logic, usually involving a lot of reflection and run-time injection of values.

TypeMock 是无价在这里,因为它有你需要的diificult隔离到模拟类型,如上面的那些一切,并且也有很多帮手,为嘲讽ASP.NET管道不必依靠Web服务器上。

TypeMock is invaluable here as it has everything you need to isolate diificult to mock types like the ones above, and also has a lot of helpers for mocking the the ASP.NET pipeline without having to rely on a web server.