What would be an alternate to [TearDown] and [SetUp] in MSTest?
Solution 1:
You would use [TestCleanup]
and [TestInitialize]
respectively.
Solution 2:
Keep in mind that your Initialize/Cleanup methods have to use the right signature.
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.classinitializeattribute.aspx
[AssemblyInitialize()]
public static void AssemblyInit(TestContext context) {}
[ClassInitialize()]
public static void ClassInit(TestContext context) {}
[TestInitialize()]
public void Initialize() {}
[TestCleanup()]
public void Cleanup() {}
[ClassCleanup()]
public static void ClassCleanup() {}
[AssemblyCleanup()]
public static void AssemblyCleanup() {}
Solution 3:
[TestInitialize]
and [TestCleanup]
at the individual test level, [ClassInitialize]
and [ClassCleanup]
at the class level.