In Visual Studio 2010 Pro, how can I easily convert a classic assembly to a ms unit test assembly ?
It there a flag to activate in the .csproj file ?
In Visual Studio 2010 Pro, how can I easily convert a classic assembly to a ms unit test assembly ?
It there a flag to activate in the .csproj file ?
Unit Test Project is only Class Library which have classes with attribute [TestClass], and .csproj file doesn't have any flags. You can add class to your project and set attribute [TestClass] and it will be test class.
Hi there.
I'll be honest, your question doesn't make sense as such. Do you mean you want to convert a "classic" (e.g. .NET 2.0?) assembly into an MS Test assembly? The only way to do that is manually change the code in VS 2010.
To do this you will need to add a reference to:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
and import the Microsoft.VisualStudio.TestTools.UnitTesting
namespace. Then, your classic assembly, you need to mark your code like this:
[TestClass]
public class YourTestClass
{
[TestMethod]
public void Test(){}
}
Using the MS Test attributes that you need.
EDIT: Doh!!! I gave you the path to wrong file, it should be:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies
Cheers. Jas.