I want to instantiate an object only once per assembly. How can I pass an object to the AssemblyInit Method?
I'm getting a compilation error. An object reference is required for the non-static field, method or property testcounter.
namespace Tests
{
[TestClass]
public class Counters
{
int testcounter = 0;
[AssemblyInitialize]
public static void AssemblyInit(TestContext context)
{
testcounter = 1;
}
[TestMethod]
public void testcounter()
{
Assert.AreEqual(testcounter,1);
}
}
}