Bud*_*Joe 4 .net tdd nunit unit-testing
我已将必要的程序集包含在VS2008中的Windows类项目中.当我开始尝试编写测试时,我得到一个红色的波浪线,并且消息[Test]不是有效的属性.我之前使用过NUnit ......也许是早期版本.我究竟做错了什么?我的版本是2.5.2.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit;
using NUnit.Core;
using NUnit.Framework;
namespace MyNamespace
{
public class LoginTests
{
[Test]
public void CanLogin()
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
小智 7
我使用2.5.3版本遇到了类似的问题.问题是我在我的nunit安装的"lib"目录中查找dll文件时应该查看"framework"目录.所以当我引用"framework \nunit.framework.dll"时,一切都运行了.希望这可以帮助
额外的using线路让你陷入困境.只能使用using NUnit.Framework;
在内部NUnit.Core也有一个名为的类型Test,你正在与它发生冲突.
您可以使用[TestAttribute]完全拼写出属性部分来解决冲突.