[TestFixture]
public class ThreadTest
{
+ static bool is_win32;
+
+ static ThreadTest ()
+ {
+ switch (Environment.OSVersion.Platform) {
+ case PlatformID.Win32NT:
+ case PlatformID.Win32S:
+ case PlatformID.Win32Windows:
+ case PlatformID.WinCE:
+ is_win32 = true;
+ break;
+ }
+ }
+
//Some Classes to test as threads
private class C1Test
{
[Category ("NotDotNet")] // it hangs.
public void TestStart()
{
+ if (is_win32)
+ Assert.Fail ("This test fails on Win32. The test should be fixed.");
{
C1Test test1 = new C1Test();
Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
[Test]
public void TestApartmentState ()
{
+ if (is_win32)
+ Assert.Fail ("This test fails on mono on win32. Our runtime should be fixed.");
+
C2Test test1 = new C2Test();
Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
Assert.AreEqual (ApartmentState.Unknown, TestThread.ApartmentState, "#1");
[Test]
public void TestPriority1()
{
+ if (is_win32)
+ Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
+
C2Test test1 = new C2Test();
Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
try {
[Test]
public void TestIsBackground1 ()
{
+ if (is_win32)
+ Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
+
C2Test test1 = new C2Test();
Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
try {
[Test]
public void TestName()
{
+ if (is_win32)
+ Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
+
C2Test test1 = new C2Test();
Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
try {
[Test]
public void TestThreadState()
{
+ if (is_win32)
+ Assert.Fail ("This test fails on mono on Win32. Our runtime should be fixed.");
+
//TODO: Test The rest of the possible transitions
C2Test test1 = new C2Test();
Thread TestThread = new Thread(new ThreadStart(test1.TestMethod));
[Category("NotDotNet")] // On MS, ThreadStateException is thrown on Abort: "Thread is suspended; attempting to abort"
public void TestSuspendAbort ()
{
+ if (is_win32)
+ Assert.Fail ("This test fails on Win32. The test should be fixed.");
+
Thread t = new Thread (new ThreadStart (DoCount));
t.IsBackground = true;
t.Start ();