Search code examples
c#.nettestingtypemock

Where is the [TestMethod] Attribute in TypeMock?


Ok, dumb question. I'm trying to set up my first TypeMock demo project in VS2005 but it doesn't recognize the [TestMethod] attribute. I've included both the TypeMock and TypeMock.ArrangeActAssert assemblies and I'm referencing them with "using" statements. Even intellisense can't find the attribute. What am I doing wrong here?


Solution

  • [TestMethod] is from the Visual Studio unit testing 'framework'. The following code shows basically how to use the attribute:

        using Microsoft.VisualStudio.TestTools.UnitTesting;
    
    [TestClass]
    public class MyTests
    {
        [TestMethod]
        public void MyFirstTest()
        {
            Assert.AreEqual(1, 1);
        }
    }
    

    If you're using NUnit or another framework, the attributes are possibily different.