-
Notifications
You must be signed in to change notification settings - Fork 758
/
TestAssemblyConfiguration.cs
182 lines (153 loc) · 7.78 KB
/
TestAssemblyConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
using System;
namespace Xunit
{
/// <summary>
/// Represents the configuration items set in the App.config file of a test assembly.
/// Should be read with the <see cref="ConfigReader"/> class.
/// </summary>
public class TestAssemblyConfiguration
{
/// <summary>
/// Gets or sets a flag indicating whether an app domain should be used to discover and run tests.
/// </summary>
public AppDomainSupport? AppDomain { get; set; }
/// <summary>
/// Gets or sets a flag indicating whether an app domain should be used to discover and run tests.
/// If the flag is not set, returns the default value (<see cref="AppDomainSupport.IfAvailable"/>).
/// </summary>
public AppDomainSupport AppDomainOrDefault { get { return AppDomain ?? AppDomainSupport.IfAvailable; } }
/// <summary>
/// Gets or sets a flag indicating that the end user wants diagnostic messages
/// from the test framework.
/// </summary>
public bool? DiagnosticMessages { get; set; }
/// <summary>
/// Gets a flag indicating that the end user wants diagnostic messages
/// from the test framework. If the flag is not set, returns the default
/// value (<c>false</c>).
/// </summary>
public bool DiagnosticMessagesOrDefault { get { return DiagnosticMessages ?? false; } }
/// <summary>
/// Gets or sets a flag indicating whether skipped tests should be turned into failures.
/// </summary>
public bool? FailSkips { get; set; }
/// <summary>
/// Gets a flag indicating whether skipped tests should be turned into failures. If the flag
/// is not set, returns the default value (<c>false</c>).
/// </summary>
public bool FailSkipsOrDefault { get { return FailSkips ?? false; } }
/// <summary>
/// Gets or sets a flag indicating that the end user wants internal diagnostic messages
/// from the test framework.
/// </summary>
public bool? InternalDiagnosticMessages { get; set; }
/// <summary>
/// Gets a flag indicating that the end user wants internal diagnostic messages
/// from the test framework. If the flag is not set, returns the default
/// value (<c>false</c>).
/// </summary>
public bool InternalDiagnosticMessagesOrDefault { get { return InternalDiagnosticMessages ?? false; } }
/// <summary>
/// Gets the number of seconds that a test can run before being considered "long running". Set to a positive
/// value to enable the feature.
/// </summary>
public int? LongRunningTestSeconds { get; set; }
/// <summary>
/// Gets the number of seconds that a test can run before being considered "long running". If the value is not
/// set, returns the default value (-1).
/// </summary>
public int LongRunningTestSecondsOrDefault { get { return LongRunningTestSeconds ?? -1; } }
/// <summary>
/// Gets or sets the maximum number of thread to use when parallelizing this assembly.
/// </summary>
public int? MaxParallelThreads { get; set; }
/// <summary>
/// Gets the maximum number of thread to use when parallelizing this assembly. If the value is not set (or set
/// to 0), returns the default value (<see cref="Environment.ProcessorCount"/>).
/// </summary>
public int MaxParallelThreadsOrDefault
{
get
{
if (!MaxParallelThreads.HasValue || MaxParallelThreads == 0)
return Environment.ProcessorCount;
return MaxParallelThreads.Value;
}
}
/// <summary>
/// Gets or sets the default display name for test methods.
/// </summary>
public TestMethodDisplay? MethodDisplay { get; set; }
/// <summary>
/// Gets the default display name for test methods. If the value is not set, returns
/// the default value (<see cref="TestMethodDisplay.ClassAndMethod"/>).
/// </summary>
public TestMethodDisplay MethodDisplayOrDefault { get { return MethodDisplay ?? TestMethodDisplay.ClassAndMethod; } }
/// <summary>
/// Gets or sets the default display options for test methods.
/// </summary>
public TestMethodDisplayOptions? MethodDisplayOptions { get; set; }
/// <summary>
/// Gets the default display options for test methods. If the value is not set, returns
/// the default value (<see cref="TestMethodDisplayOptions.None"/>).
/// </summary>
public TestMethodDisplayOptions MethodDisplayOptionsOrDefault { get { return MethodDisplayOptions ?? TestMethodDisplayOptions.None; } }
/// <summary>
/// Gets or sets the algorithm to be used for parallelization.
/// </summary>
public ParallelAlgorithm? ParallelAlgorithm { get; set; }
/// <summary>
/// Gets or sets the algorithm to be used for parallelization.
/// </summary>
public ParallelAlgorithm ParallelAlgorithmOrDefault { get { return ParallelAlgorithm ?? Xunit.ParallelAlgorithm.Conservative; } }
/// <summary>
/// Gets or sets a flag indicating that this assembly is safe to parallelize against
/// other assemblies.
/// </summary>
public bool? ParallelizeAssembly { get; set; }
/// <summary>
/// Gets a flag indicating that this assembly is safe to parallelize against
/// other assemblies. If the flag is not set, returns the default value (<c>false</c>).
/// </summary>
public bool ParallelizeAssemblyOrDefault { get { return ParallelizeAssembly ?? false; } }
/// <summary>
/// Gets or sets a flag indicating that this test assembly wants to run test collections
/// in parallel against one another.
/// </summary>
public bool? ParallelizeTestCollections { get; set; }
/// <summary>
/// Gets a flag indicating that this test assembly wants to run test collections
/// in parallel against one another. If the flag is not set, returns the default
/// value (<c>true</c>).
/// </summary>
public bool ParallelizeTestCollectionsOrDefault { get { return ParallelizeTestCollections ?? true; } }
/// <summary>
/// Gets or sets a flag indicating whether theory data should be pre-enumerated during
/// test discovery.
/// </summary>
public bool? PreEnumerateTheories { get; set; }
/// <summary>
/// Gets a flag indicating whether theory data should be pre-enumerated during
/// test discovery. If the flag is not set, returns the default value (<c>true</c>).
/// </summary>
public bool PreEnumerateTheoriesOrDefault { get { return PreEnumerateTheories ?? true; } }
/// <summary>
/// Gets or sets a flag indicating whether shadow copies should be used.
/// </summary>
public bool? ShadowCopy { get; set; }
/// <summary>
/// Gets a flag indicating whether shadow copies should be used. If the flag is not set,
/// returns the default value (<c>true</c>).
/// </summary>
public bool ShadowCopyOrDefault { get { return ShadowCopy ?? true; } }
/// <summary>
/// Gets or sets a flag indicating whether testing should stop on a failure.
/// </summary>
public bool? StopOnFail { get; set; }
/// <summary>
/// Gets a flag indicating whether testing should stop on a test failure. If the flag is not set,
/// returns the default value (<c>false</c>).
/// </summary>
public bool StopOnFailOrDefault { get { return StopOnFail ?? false; } }
}
}