在asp.net中实现model-view-controller模式(五)
测试
将模型部分从asp.net环境中分离出来能够使模型部分更容易的被测试。在asp.net环境中进行测试的话,你必须同时测试很多方面,如html代码是否正确,而读取html代码的工作是非常烦闷的。将模型部分分离出来,使你能够对模型部分做单独的单元测试。下面是nunit (http://nunit.org)对模型部分进行单元测试的例子。
using system;
using nunit.framework;
using system.collections;
using system.data;
using system.data.sqlclient;
[testfixture]
public class gatewayfixture
{
[test]