~ubuntu-branches/debian/sid/nunit/sid

« back to all changes in this revision

Viewing changes to src/NUnitFramework/framework/Attributes/ThreadingAttributes.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2014-09-16 13:43:36 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20140916134336-kjxz48tty6lx2ja5
Tags: 2.6.3+dfsg-1
* [c7bd1b5] Imported Upstream version 2.6.3+dfsg
* [bcb4bf8] Move nunit-console-runner to GAC-installed libnunit2.6, 
  don't treat it as a private lib. This lib is signed, and treated 
  as a GAC lib by consumers such as MonoDevelop.
* [7f08e99] Bump version to 2.6.3 as required
* [84535eb] Refreshed patches
* [8479f61] Split package up into per-assembly packages. This makes 
  ABI tracking easier in the future, as we can meaningfully have GAC 
  policy for cases where ABI isn't truly bumped, and no policy for 
  cases where it is. For example, if nunit.framework bumps ABI but 
  nunit.core does not, previously we would need to rebuild everything 
  using NUnit, but under the new split packaging, that rebuild would 
  not be needed for apps only using nunit.core.
* [17a7dc7] Add missing nunit.mocks.dll to nunit.pc

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ****************************************************************
2
 
// Copyright 2008, Charlie Poole
3
 
// This is free software licensed under the NUnit license. You may
4
 
// obtain a copy of the license at http://nunit.org
5
 
// ****************************************************************
6
 
 
7
 
using System;
8
 
using System.Threading;
9
 
 
10
 
namespace NUnit.Framework
11
 
{
12
 
    /// <summary>
13
 
    /// Used on a method, marks the test with a timeout value in milliseconds. 
14
 
    /// The test will be run in a separate thread and is cancelled if the timeout 
15
 
    /// is exceeded. Used on a method or assembly, sets the default timeout 
16
 
    /// for all contained test methods.
17
 
    /// </summary>
18
 
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
19
 
    public class TimeoutAttribute : PropertyAttribute
20
 
    {
21
 
        /// <summary>
22
 
        /// Construct a TimeoutAttribute given a time in milliseconds
23
 
        /// </summary>
24
 
        /// <param name="timeout">The timeout value in milliseconds</param>
25
 
        public TimeoutAttribute(int timeout)
26
 
            : base(timeout) { }
27
 
    }
28
 
 
29
 
    /// <summary>
30
 
    /// Marks a test that must run in the STA, causing it
31
 
    /// to run in a separate thread if necessary.
32
 
    /// 
33
 
    /// On methods, you may also use STAThreadAttribute
34
 
    /// to serve the same purpose.
35
 
    /// </summary>
36
 
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
37
 
    public class RequiresSTAAttribute : PropertyAttribute
38
 
    {
39
 
        /// <summary>
40
 
        /// Construct a RequiresSTAAttribute
41
 
        /// </summary>
42
 
        public RequiresSTAAttribute()
43
 
        {
44
 
            this.Properties.Add("APARTMENT_STATE", ApartmentState.STA);
45
 
        }
46
 
    }
47
 
 
48
 
    /// <summary>
49
 
    /// Marks a test that must run in the MTA, causing it
50
 
    /// to run in a separate thread if necessary.
51
 
    /// 
52
 
    /// On methods, you may also use MTAThreadAttribute
53
 
    /// to serve the same purpose.
54
 
    /// </summary>
55
 
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
56
 
    public class RequiresMTAAttribute : PropertyAttribute
57
 
    {
58
 
        /// <summary>
59
 
        /// Construct a RequiresMTAAttribute
60
 
        /// </summary>
61
 
        public RequiresMTAAttribute()
62
 
        {
63
 
            this.Properties.Add("APARTMENT_STATE", ApartmentState.MTA);
64
 
        }
65
 
    }
66
 
 
67
 
    /// <summary>
68
 
    /// Marks a test that must run on a separate thread.
69
 
    /// </summary>
70
 
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
71
 
    public class RequiresThreadAttribute : PropertyAttribute
72
 
    {
73
 
        /// <summary>
74
 
        /// Construct a RequiresThreadAttribute
75
 
        /// </summary>
76
 
        public RequiresThreadAttribute()
77
 
            : base(true) { }
78
 
 
79
 
        /// <summary>
80
 
        /// Construct a RequiresThreadAttribute, specifying the apartment
81
 
        /// </summary>
82
 
        public RequiresThreadAttribute(ApartmentState apartment)
83
 
            : base(true)
84
 
        {
85
 
            this.Properties.Add("APARTMENT_STATE", apartment);
86
 
        }
87
 
    }
88
 
}
 
1
// ****************************************************************
 
2
// Copyright 2008, Charlie Poole
 
3
// This is free software licensed under the NUnit license. You may
 
4
// obtain a copy of the license at http://nunit.org
 
5
// ****************************************************************
 
6
 
 
7
using System;
 
8
using System.Threading;
 
9
 
 
10
namespace NUnit.Framework
 
11
{
 
12
    /// <summary>
 
13
    /// Used on a method, marks the test with a timeout value in milliseconds. 
 
14
    /// The test will be run in a separate thread and is cancelled if the timeout 
 
15
    /// is exceeded. Used on a method or assembly, sets the default timeout 
 
16
    /// for all contained test methods.
 
17
    /// </summary>
 
18
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
 
19
    public class TimeoutAttribute : PropertyAttribute
 
20
    {
 
21
        /// <summary>
 
22
        /// Construct a TimeoutAttribute given a time in milliseconds
 
23
        /// </summary>
 
24
        /// <param name="timeout">The timeout value in milliseconds</param>
 
25
        public TimeoutAttribute(int timeout)
 
26
            : base(timeout) { }
 
27
    }
 
28
 
 
29
    /// <summary>
 
30
    /// Marks a test that must run in the STA, causing it
 
31
    /// to run in a separate thread if necessary.
 
32
    /// 
 
33
    /// On methods, you may also use STAThreadAttribute
 
34
    /// to serve the same purpose.
 
35
    /// </summary>
 
36
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
 
37
    public class RequiresSTAAttribute : PropertyAttribute
 
38
    {
 
39
        /// <summary>
 
40
        /// Construct a RequiresSTAAttribute
 
41
        /// </summary>
 
42
        public RequiresSTAAttribute()
 
43
        {
 
44
            this.Properties.Add("APARTMENT_STATE", ApartmentState.STA);
 
45
        }
 
46
    }
 
47
 
 
48
    /// <summary>
 
49
    /// Marks a test that must run in the MTA, causing it
 
50
    /// to run in a separate thread if necessary.
 
51
    /// 
 
52
    /// On methods, you may also use MTAThreadAttribute
 
53
    /// to serve the same purpose.
 
54
    /// </summary>
 
55
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
 
56
    public class RequiresMTAAttribute : PropertyAttribute
 
57
    {
 
58
        /// <summary>
 
59
        /// Construct a RequiresMTAAttribute
 
60
        /// </summary>
 
61
        public RequiresMTAAttribute()
 
62
        {
 
63
            this.Properties.Add("APARTMENT_STATE", ApartmentState.MTA);
 
64
        }
 
65
    }
 
66
 
 
67
    /// <summary>
 
68
    /// Marks a test that must run on a separate thread.
 
69
    /// </summary>
 
70
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false, Inherited=false)]
 
71
    public class RequiresThreadAttribute : PropertyAttribute
 
72
    {
 
73
        /// <summary>
 
74
        /// Construct a RequiresThreadAttribute
 
75
        /// </summary>
 
76
        public RequiresThreadAttribute()
 
77
            : base(true) { }
 
78
 
 
79
        /// <summary>
 
80
        /// Construct a RequiresThreadAttribute, specifying the apartment
 
81
        /// </summary>
 
82
        public RequiresThreadAttribute(ApartmentState apartment)
 
83
            : base(true)
 
84
        {
 
85
            this.Properties.Add("APARTMENT_STATE", apartment);
 
86
        }
 
87
    }
 
88
}