I'm using the NUnit test runner included in Monodevelop. I have 2 tests which must interact with static resources so I need them to run serially rather than parallel. I've tried using something like
static string Locker="foo";
[Test]
public void Test1()
{
lock(Locker)
{
//....
}
}
[Test]
public void Test2()
{
lock(Locker)
{
//....
}
}
This doesn't seem to work though. Is there some other way?
I'm using this approach when REALLY needed (i think it's a bad idea):
using System.Threading;
private ManualResetEvent FixtureHandle = new ManualResetEvent(true);
[SetUp]
public void SetUp()
{
FixtureHandle.WaitOne();
}
[TearDown]
public void TearDown()
{
FixtureHandle.Set();
}
[Test]
public void Test1()
{
//only test
}
[Test]
public void Test2()
{
//only test
}
Dont know about Monodevelop but nunit console has command line argument /nothread
It should be something similar in Monodevelop i think
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With