@@ -11,9 +11,8 @@ namespace TestStack.White.Configuration
11
11
{
12
12
public class CoreAppXmlConfiguration : AssemblyConfiguration , ICoreConfiguration
13
13
{
14
- private static ICoreConfiguration instance ;
14
+ private static ICoreConfiguration instance = new CoreAppXmlConfiguration ( ) ;
15
15
private readonly DynamicProxyInterceptors interceptors = new DynamicProxyInterceptors ( ) ;
16
-
17
16
private static readonly Dictionary < string , object > DefaultValues = new Dictionary < string , object > ( ) ;
18
17
19
18
static CoreAppXmlConfiguration ( )
@@ -35,12 +34,12 @@ static CoreAppXmlConfiguration()
35
34
DefaultValues . Add ( "MaxElementSearchDepth" , 10 ) ;
36
35
DefaultValues . Add ( "DoubleClickInterval" , 0 ) ;
37
36
DefaultValues . Add ( "MoveMouseToGetStatusOfHourGlass" , true ) ;
38
- DefaultValues . Add ( "InvertMouseButtons " , true ) ;
37
+ DefaultValues . Add ( "KeepOpenOnDispose " , false ) ;
39
38
}
40
39
41
40
public static ICoreConfiguration Instance
42
41
{
43
- get { return instance ?? ( instance = new CoreAppXmlConfiguration ( ) ) ; }
42
+ get { return instance ; }
44
43
}
45
44
46
45
private CoreAppXmlConfiguration ( )
@@ -51,15 +50,32 @@ private CoreAppXmlConfiguration()
51
50
LoggerFactory = new WhiteDefaultLoggerFactory ( LoggerLevel . Info ) ;
52
51
}
53
52
53
+ public virtual ILoggerFactory LoggerFactory { get ; set ; }
54
+
55
+ public virtual IDisposable ApplyTemporarySetting ( Action < ICoreConfiguration > changes )
56
+ {
57
+ var existing = new Dictionary < string , string > ( UsedValues ) ;
58
+ changes ( this ) ;
59
+
60
+ return new DelegateDisposable ( ( ) =>
61
+ {
62
+ foreach ( var value in existing )
63
+ {
64
+ SetUsedValue ( value . Key , value . Value ) ;
65
+ }
66
+ } ) ;
67
+ }
68
+
54
69
private void SetUsedValue ( string key , object value )
55
70
{
56
71
UsedValues [ key ] = value . ToString ( ) ;
57
72
}
58
73
59
- public virtual DirectoryInfo WorkSessionLocation
74
+ public virtual IWaitHook AdditionalWaitHook { get ; set ; }
75
+
76
+ public virtual DynamicProxyInterceptors Interceptors
60
77
{
61
- get { return new DirectoryInfo ( UsedValues [ "WorkSessionLocation" ] ) ; }
62
- set { SetUsedValue ( "WorkSessionLocation" , value ) ; }
78
+ get { return interceptors ; }
63
79
}
64
80
65
81
public virtual int BusyTimeout
@@ -80,9 +96,10 @@ public virtual bool WaitBasedOnHourGlass
80
96
set { SetUsedValue ( "WaitBasedOnHourGlass" , value ) ; }
81
97
}
82
98
83
- public virtual DynamicProxyInterceptors Interceptors
99
+ public virtual DirectoryInfo WorkSessionLocation
84
100
{
85
- get { return interceptors ; }
101
+ get { return new DirectoryInfo ( UsedValues [ "WorkSessionLocation" ] ) ; }
102
+ set { SetUsedValue ( "WorkSessionLocation" , value ) ; }
86
103
}
87
104
88
105
public virtual int UIAutomationZeroWindowBugTimeout
@@ -139,46 +156,37 @@ public virtual bool ComboBoxItemsPopulatedWithoutDropDownOpen
139
156
set { SetUsedValue ( "ComboBoxItemsPopulatedWithoutDropDownOpen" , value ) ; }
140
157
}
141
158
142
- public virtual bool MoveMouseToGetStatusOfHourGlass
143
- {
144
- get { return Convert . ToBoolean ( UsedValues [ "MoveMouseToGetStatusOfHourGlass" ] ) ; }
145
- set { SetUsedValue ( "MoveMouseToGetStatusOfHourGlass" , value ) ; }
146
- }
147
-
148
- public virtual ILoggerFactory LoggerFactory { get ; set ; }
149
-
150
- public virtual IDisposable ApplyTemporarySetting ( Action < ICoreConfiguration > changes )
159
+ public virtual bool RawElementBasedSearch
151
160
{
152
- var existing = new Dictionary < string , string > ( UsedValues ) ;
153
- changes ( this ) ;
154
-
155
- return new DelegateDisposable ( ( ) =>
156
- {
157
- foreach ( var value in existing )
158
- {
159
- SetUsedValue ( value . Key , value . Value ) ;
160
- }
161
- } ) ;
161
+ get { return Convert . ToBoolean ( UsedValues [ "RawElementBasedSearch" ] ) ; }
162
+ set { SetUsedValue ( "RawElementBasedSearch" , value ) ; }
162
163
}
163
164
164
- public virtual IWaitHook AdditionalWaitHook { get ; set ; }
165
-
166
165
public virtual int MaxElementSearchDepth
167
166
{
168
167
get { return Convert . ToInt32 ( UsedValues [ "MaxElementSearchDepth" ] ) ; }
169
168
set { SetUsedValue ( "MaxElementSearchDepth" , value ) ; }
170
169
}
171
170
172
- public virtual bool RawElementBasedSearch
173
- {
174
- get { return Convert . ToBoolean ( UsedValues [ "RawElementBasedSearch" ] ) ; }
175
- set { SetUsedValue ( "RawElementBasedSearch" , value ) ; }
176
- }
177
-
178
171
public virtual int DoubleClickInterval
179
172
{
180
173
get { return Convert . ToInt32 ( UsedValues [ "DoubleClickInterval" ] ) ; }
181
174
set { SetUsedValue ( "DoubleClickInterval" , value ) ; }
182
175
}
176
+
177
+ public virtual bool MoveMouseToGetStatusOfHourGlass
178
+ {
179
+ get { return Convert . ToBoolean ( UsedValues [ "MoveMouseToGetStatusOfHourGlass" ] ) ; }
180
+ set { SetUsedValue ( "MoveMouseToGetStatusOfHourGlass" , value ) ; }
181
+ }
182
+
183
+ /// <summary>
184
+ /// Implements <see cref="ICoreConfiguration.KeepOpenOnDispose"/>
185
+ /// </summary>
186
+ public virtual bool KeepOpenOnDispose
187
+ {
188
+ get { return Convert . ToBoolean ( UsedValues [ "KeepOpenOnDispose" ] ) ; }
189
+ set { SetUsedValue ( "KeepOpenOnDispose" , value ) ; }
190
+ }
183
191
}
184
192
}
0 commit comments