~a-schlapsi/nunit-3.0/linux-makefile

« back to all changes in this revision

Viewing changes to src/tests/Attributes/ThreadingTests.cs

  • Committer: Andreas Schlapsi
  • Date: 2010-01-23 23:14:05 UTC
  • mfrom: (18.1.137 work)
  • Revision ID: a.schlapsi@gmx.at-20100123231405-17deqoh18nfnbq1j
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
using System;
25
25
using System.Threading;
26
26
using NUnit.Framework;
 
27
using NUnit.Framework.Api;
27
28
using NUnit.TestData.ThreadingFixture;
28
29
using NUnit.TestUtilities;
29
30
 
30
 
namespace NUnit.Core.Tests
 
31
namespace NUnit.Framework.Attributes
31
32
{
32
33
    //[Platform(Exclude = "Mono", Reason = "Runner hangs at end when these are run")]
33
34
    public class ThreadingTests
66
67
        [Platform(Exclude = "Mono", Reason = "Runner hangs at end when this is run")]
67
68
        public void TestWithInfiniteLoopTimesOut()
68
69
        {
69
 
            TestResult result = TestBuilder.RunTestCase(
 
70
            ITestResult result = TestBuilder.RunTestCase(
70
71
                typeof(ThreadingFixture), "InfiniteLoopWith50msTimeout");
71
72
            Assert.That(result.ResultState, Is.EqualTo(ResultState.Failure));
72
73
            Assert.That(result.Message, Contains.Substring("50ms"));
73
74
        }
74
75
 
75
 
        [Test, STAThread]
76
 
        public void TestWithSTAThreadRunsInSTA()
77
 
        {
78
 
            Assert.That(Thread.CurrentThread.ApartmentState, Is.EqualTo(ApartmentState.STA));
79
 
            if (parentThreadApartment == ApartmentState.STA)
80
 
                Assert.That(Thread.CurrentThread, Is.EqualTo(parentThread));
81
 
        }
 
76
        //[Test, STAThread]
 
77
        //public void TestWithSTAThreadRunsInSTA()
 
78
        //{
 
79
        //    Assert.That(Thread.CurrentThread.ApartmentState, Is.EqualTo(ApartmentState.STA));
 
80
        //    if (parentThreadApartment == ApartmentState.STA)
 
81
        //        Assert.That(Thread.CurrentThread, Is.EqualTo(parentThread));
 
82
        //}
82
83
 
83
 
        [Test, MTAThread]
84
 
        public void TestWithMTAThreadRunsInMTA()
85
 
        {
86
 
            Assert.That(Thread.CurrentThread.ApartmentState, Is.EqualTo(ApartmentState.MTA));
87
 
            if (parentThreadApartment == ApartmentState.MTA)
88
 
                Assert.That(Thread.CurrentThread, Is.EqualTo(parentThread));
89
 
        }
 
84
        //[Test, MTAThread]
 
85
        //public void TestWithMTAThreadRunsInMTA()
 
86
        //{
 
87
        //    Assert.That(Thread.CurrentThread.ApartmentState, Is.EqualTo(ApartmentState.MTA));
 
88
        //    if (parentThreadApartment == ApartmentState.MTA)
 
89
        //        Assert.That(Thread.CurrentThread, Is.EqualTo(parentThread));
 
90
        //}
90
91
 
91
92
        [Test, RequiresSTA]
92
93
        public void TestWithRequiresSTARunsInSTA()
134
135
        [Platform(Exclude = "Mono", Reason = "Runner hangs at end when this is run")]
135
136
        public void TimeoutCanBeSetOnTestFixture()
136
137
        {
137
 
            TestResult result = TestBuilder.RunTestFixture(typeof(ThreadingFixtureWithTimeout));
 
138
            ITestResult result = TestBuilder.RunTestFixture(typeof(ThreadingFixtureWithTimeout));
138
139
            Assert.That(result.ResultState, Is.EqualTo(ResultState.Failure));
139
140
            result = TestFinder.Find("Test2WithInfiniteLoop", result, false);
140
141
            Assert.That(result.ResultState, Is.EqualTo(ResultState.Failure));