问题
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