@@ -15,19 +15,24 @@ namespace NUnit.Framework
15
15
[ AttributeUsage ( AttributeTargets . Method | AttributeTargets . Class | AttributeTargets . Assembly , AllowMultiple = false , Inherited = false ) ]
16
16
public class IgnoreAttribute : NUnitAttribute , IApplyToTest
17
17
{
18
- private readonly string _reason ;
19
18
private DateTime ? _untilDate ;
20
19
private string ? _until ;
21
20
22
21
/// <summary>
23
- /// Constructs the attribute giving a reason for ignoring the test
22
+ /// Constructs the attribute giving a reason for ignoring the test.
24
23
/// </summary>
25
- /// <param name="reason">The reason for ignoring the test</param>
24
+ /// <param name="reason">The reason for ignoring the test.</param>
25
+ /// <exception cref="ArgumentNullException">If <paramref name="reason"/> is null.</exception>
26
26
public IgnoreAttribute ( string reason )
27
27
{
28
- _reason = reason ;
28
+ Reason = reason ;
29
29
}
30
30
31
+ /// <summary>
32
+ /// Gets the reason for ignoring the test.
33
+ /// </summary>
34
+ public string Reason { get ; }
35
+
31
36
/// <summary>
32
37
/// The date in the future to stop ignoring the test as a string in UTC time.
33
38
/// For example for a date and time, "2014-12-25 08:10:00Z" or for just a date,
@@ -66,14 +71,14 @@ public void ApplyToTest(Test test)
66
71
if ( _untilDate . Value > DateTime . Now )
67
72
{
68
73
test . RunState = RunState . Ignored ;
69
- test . Properties . AddIgnoreUntilReason ( _untilDate . Value , _reason ) ;
74
+ test . Properties . AddIgnoreUntilReason ( _untilDate . Value , Reason ) ;
70
75
}
71
76
test . Properties . Set ( PropertyNames . IgnoreUntilDate , _untilDate . Value . ToString ( "u" ) ) ;
72
77
73
78
return ;
74
79
}
75
80
test . RunState = RunState . Ignored ;
76
- test . Properties . Set ( PropertyNames . SkipReason , _reason ) ;
81
+ test . Properties . Set ( PropertyNames . SkipReason , Reason ) ;
77
82
}
78
83
}
79
84
0 commit comments