也许我只是忘记了一些事情,但我似乎无法让 NUnit 在 Visual Studio 2008 标准版中工作。我正在尝试在 C# 类库项目中使用 NUnit 2.5.7。我遵循 NUnit 下载中给出的示例结构。
以下是我正在执行的步骤
1)下载并安装 NUnit 2.5.7
2)创建 C# 类库项目
3)将 NUnit.Framework 的引用添加到我的项目中
4)创建一个类
5)添加“使用 NUnit.Framework”
6)从步骤 3 在我的班级顶部添加 [TestFixture]
问题出现在第 6 步,Visual Studio 根本无法识别 TestFixtureAttribute 或 TestAttribute。NUnit 下载中包含的示例仅包含步骤 5 中的 using 语句和 [TestFixture]。我错过了什么?
using System;
using NUnit.Framework;
namespace UnitTests
{
[TestFixture]
public class MyUnitTests
{
[Test]
public void TestMethod1()
{
//my unit test
}
}
}
谢谢