Assert Method Error

若如初见. 提交于 2019-12-11 08:42:32

问题


I am using the line Assert.IsNotNull(object); in my code. I keep getting the error:

the name assert does not exist in the current content

Can someone please tell me what I'm missing?


回答1:


You need to add Microsoft.VisualStudio.QualityTools.UnitTestFramework to your project references and add

using Microsoft.VisualStudio.TestTools.UnitTesting;



回答2:


Is sounds like you don't have an appropriate using directive, such as

using NUnit.Framework;

in your code. The exact directive will depend on which unit testing framework you're using, of course. I'd expect you to get the same problem for other things though - particularly [Test] attributes etc.



来源:https://stackoverflow.com/questions/8695595/assert-method-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!