VS2008 c# 中使用 NUnit 2.4.8

c#(VS2008)中使用NUNIT (2.4.8)过程。

     正在看《面向对象开发实践之路C#》李维著(PDF)。由于使用的开发工具与NUnit版本的不同,根据书中的说法与自己的实践过程记录下来。

1。下载 NUNIT过程略去,这里下载的是2.4.8的msi,安装NUNIT完毕后,启动VS2008 C#环境。

2.  按照《面向对象开发实践之路C#》中的例子建立PFMNUnitDemo.dll项目。

3。在项目“solution explore”-->“PFMNUnitDemo”(工程名称)-->“references”点击鼠标右键,出现菜单选择"Add reference..." 添加nunit.framework.

4.VS2008 菜单项“project”--> "PFMNUnitDemo Properties..”(或者 xxxx工程名称 Properties)-->"Debug"--->"start action"选择"start external program"并输入nunit2.4.8所在目录之执行文件,这里是C:\Program Files\NUnit 2.4.8\bin\nunit.exe

5.注意点:

   a. "'Assembly Name' has no TestFixtures" 错误。在写测试类时,不要忘了类前面加上public

       程序集的文件名必须为aa.dll,不能为aa.bb.dll(不知道原因何在,请高手指正)。

       红字部分今天试了一下又好了,我觉得应该是Cache的问题

   b.  "ArrayList问题" 将 using System.Collections.Generic; 改为 using System.Collections;

   c. "warning CS1591: Missing XML comment for publicly visible type or member....."问题。

      屏蔽该告警的办法:VS2008菜单项“project”--> "PFMNUnitDemo Properties..”(或者 xxxx工程名称 Properties)-->"Build"--->"Errors and warnings"--->"Suppress warnings"中填入1591即可,如果需要屏蔽多个warning,使用逗号分隔。eg :  1591,1592,1570

原文地址:https://www.cnblogs.com/sonicit/p/1255689.html