2012-01-01 98 views
1

我在我的代码中使用行Assert.IsNotNull(object);。我不断收到错误:断言方法错误

the name assert does not exist in the current content

有人能告诉我我失踪了什么吗?

+0

(如果我的回答并不能帮助你,请提供更多信息。) – 2012-01-01 21:18:23

回答

4

您需要添加Microsoft.VisualStudio.QualityTools.UnitTestFramework到您的项目引用,并添加

using Microsoft.VisualStudio.TestTools.UnitTesting; 
+0

感谢您的帮助! – K720 2012-01-01 21:53:43

+0

如果解决了您的问题,请不要忘记接受答案。 :) – Tudor 2012-01-01 23:04:54

4

是听起来像你没有一个合适的using指令,如

using NUnit.Framework; 
在你的代码

。当然,确切的指令将取决于您使用的单元测试框架。我希望你虽然得到其他的东西同样的问题 - 尤其是[Test]属性等