public void SelectAllAbiModuleTest()
        {
            AbiModuleDAO target = new AbiModuleDAO();            System.Collections.Generic.IList<Model.AbiModuleInfo> expected = target.SelectAllAbiModule();
            
            System.Collections.Generic.IList<Model.AbiModuleInfo> actual;            actual = target.SelectAllAbiModule();            Assert.AreEqual(expected, actual, "SqlServerDAL.AbiModuleDAO.SelectAllAbiModule 未返回所需的值。");
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
我这里期望的返回值是非空...只要不是空,就成....应该怎么描述啊?
还有,负载测试。是不是必须是在完成了单元测试后才能进行?

解决方案 »

  1.   

    不一定是非要设个期望,设个实际,只要最后用assert断言判断就行了。别被vs自动生成的代码迷惑了~
      

  2.   

     public void AddAbiModuleTest()
            {
                AbiModuleDAO target = new AbiModuleDAO();            AbiModuleInfo abiModule = null; // TODO: 初始化为适当的值
                abiModule.AbiModuleName = "yiwe";
                abiModule.AbiModuleDes = "we";            
                int expected = 1;
                int actual;            actual = target.AddAbiModule(abiModule);
                           Assert.AreEqual( test, "SqlServerDAL.AbiModuleDAO.AddAbiModule 未返回所需的值。");
                //Assert.Inconclusive("验证此测试方法的正确性。");
            }
    那这段呢?这是个插入的存储过程....返回值应为大于0。但是,它却返回了如下的异常:
    引发异常:  System.NullReferenceException: 未将对象引用设置到对象的实例。。不知道是什么原因...