Are there non-static equivalents to MSTest's [ClassCleanup] & [ClassInitialize]?
I am using MSTest for some system/integration level tests, and I don't want to have to worry about cleaning & initializing the connection in the tests.
Example Code:
[TestClass]
public class DefectCreatorTest
{
private long _cookie;
private soapcgi _soap;
[ClassInitialize]
public void Initialize()
{
_soap = new soapcgi {Url = "http://localhost:80/scripts/soapcgi.exe"};
_cookie = Transaction.Login(_soap);
}
[ClassCleanup]
public void TearDown()
{
Transaction.Logout(_cookie, _soap);
}
[TestMethod]
public void CreateDefectTest()
{
var result = _soap.Foo();
Assert.AreEqual("bar", result);
}
}