@@ -19,76 +19,49 @@ public class RunConfigurationSettings
19
19
/// </summary>
20
20
public const string SettingsName = "RunConfiguration" ;
21
21
22
- /// <summary>
23
- /// Member variable for RunConfiguration settings
24
- /// </summary>
25
- private static RunConfigurationSettings configurationSettings ;
26
-
27
22
/// <summary>
28
23
/// Initializes a new instance of the <see cref="RunConfigurationSettings"/> class.
29
24
/// </summary>
30
25
public RunConfigurationSettings ( )
31
26
{
32
- this . DesignMode = true ;
27
+ this . CollectSourceInformation = true ;
33
28
}
34
29
35
30
/// <summary>
36
- /// Gets the current settings .
31
+ /// Gets a value indicating whether source information needs to be collected or not .
37
32
/// </summary>
38
- public static RunConfigurationSettings ConfigurationSettings
39
- {
40
- get
41
- {
42
- if ( configurationSettings == null )
43
- {
44
- configurationSettings = new RunConfigurationSettings ( ) ;
45
- }
46
-
47
- return configurationSettings ;
48
- }
49
-
50
- private set
51
- {
52
- configurationSettings = value ;
53
- }
54
- }
55
-
56
- /// <summary>
57
- /// Gets a value indicating whether designMode is on(IDE scenario) or off(CLI scenario).
58
- /// </summary>
59
- public bool DesignMode { get ; private set ; }
33
+ public bool CollectSourceInformation { get ; private set ; }
60
34
61
35
/// <summary>
62
36
/// Populate adapter settings from the context
63
37
/// </summary>
64
38
/// <param name="context">
65
39
/// The discovery context that contains the runsettings.
66
40
/// </param>
67
- public static void PopulateSettings ( IDiscoveryContext context )
41
+ /// <returns>Populated RunConfigurationSettings from the discovery context.</returns>
42
+ public static RunConfigurationSettings PopulateSettings ( IDiscoveryContext context )
68
43
{
69
44
if ( context == null || context . RunSettings == null || string . IsNullOrEmpty ( context . RunSettings . SettingsXml ) )
70
45
{
71
- // This will contain default adapter settings
72
- ConfigurationSettings = new RunConfigurationSettings ( ) ;
73
- return ;
46
+ // This will contain default configuration settings
47
+ return new RunConfigurationSettings ( ) ;
74
48
}
75
49
76
50
var settings = GetSettings ( context . RunSettings . SettingsXml , SettingsName ) ;
77
51
78
52
if ( settings != null )
79
53
{
80
- ConfigurationSettings = settings ;
81
- return ;
54
+ return settings ;
82
55
}
83
56
84
- ConfigurationSettings = new RunConfigurationSettings ( ) ;
57
+ return new RunConfigurationSettings ( ) ;
85
58
}
86
59
87
60
/// <summary>
88
- /// Gets the adapter specific settings from the xml.
61
+ /// Gets the configuration settings from the xml.
89
62
/// </summary>
90
63
/// <param name="runsettingsXml"> The xml with the settings passed from the test platform. </param>
91
- /// <param name="settingName"> The name of the adapter settings to fetch - Its either MSTest or MSTestV2 </param>
64
+ /// <param name="settingName"> The name of the settings to fetch. </param>
92
65
/// <returns> The settings if found. Null otherwise. </returns>
93
66
internal static RunConfigurationSettings GetSettings ( string runsettingsXml , string settingName )
94
67
{
@@ -118,14 +91,6 @@ internal static RunConfigurationSettings GetSettings(string runsettingsXml, stri
118
91
return null ;
119
92
}
120
93
121
- /// <summary>
122
- /// Resets any settings loaded.
123
- /// </summary>
124
- internal static void Reset ( )
125
- {
126
- RunConfigurationSettings . ConfigurationSettings = null ;
127
- }
128
-
129
94
/// <summary>
130
95
/// Convert the parameter xml to TestSettings
131
96
/// </summary>
@@ -139,12 +104,12 @@ private static RunConfigurationSettings ToSettings(XmlReader reader)
139
104
//
140
105
// <Runsettings>
141
106
// <RunConfiguration>
142
- // <DesignMode >true</DesignMode >
107
+ // <CollectSourceInformation >true</CollectSourceInformation >
143
108
// </RunConfiguration>
144
109
// </Runsettings>
145
110
RunConfigurationSettings settings = new RunConfigurationSettings ( ) ;
146
111
147
- // Read the first element in the section which is either "MSTest"/"MSTestV2"
112
+ // Read the first element in the section
148
113
reader . ReadToNextElement ( ) ;
149
114
150
115
if ( ! reader . IsEmptyElement )
@@ -157,13 +122,13 @@ private static RunConfigurationSettings ToSettings(XmlReader reader)
157
122
string elementName = reader . Name . ToUpperInvariant ( ) ;
158
123
switch ( elementName )
159
124
{
160
- case "DESIGNMODE " :
125
+ case "COLLECTSOURCEINFORMATION " :
161
126
{
162
127
if ( bool . TryParse ( reader . ReadInnerXml ( ) , out result ) )
163
128
{
164
- settings . DesignMode = result ;
129
+ settings . CollectSourceInformation = result ;
165
130
PlatformServiceProvider . Instance . AdapterTraceLogger . LogInfo (
166
- "DesignMode value Found : {0} " ,
131
+ "CollectSourceInformation value Found : {0} " ,
167
132
result ) ;
168
133
}
169
134
0 commit comments