@@ -47,7 +47,8 @@ public void GitProcess_GetConfiguration_ReturnsConfiguration()
47
47
{
48
48
string gitPath = GetGitPath ( ) ;
49
49
var trace = new NullTrace ( ) ;
50
- var git = new GitProcess ( trace , gitPath ) ;
50
+ var env = new TestEnvironment ( ) ;
51
+ var git = new GitProcess ( trace , env , gitPath ) ;
51
52
var config = git . GetConfiguration ( ) ;
52
53
Assert . NotNull ( config ) ;
53
54
}
@@ -69,7 +70,8 @@ public void GitConfiguration_Enumerate_CallbackReturnsTrue_InvokesCallbackForEac
69
70
70
71
string gitPath = GetGitPath ( ) ;
71
72
var trace = new NullTrace ( ) ;
72
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
73
+ var env = new TestEnvironment ( ) ;
74
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
73
75
IGitConfiguration config = git . GetConfiguration ( ) ;
74
76
75
77
var actualVisitedEntries = new List < ( string name , string value ) > ( ) ;
@@ -106,7 +108,8 @@ public void GitConfiguration_Enumerate_CallbackReturnsFalse_InvokesCallbackForEa
106
108
107
109
string gitPath = GetGitPath ( ) ;
108
110
var trace = new NullTrace ( ) ;
109
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
111
+ var env = new TestEnvironment ( ) ;
112
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
110
113
IGitConfiguration config = git . GetConfiguration ( ) ;
111
114
112
115
var actualVisitedEntries = new List < ( string name , string value ) > ( ) ;
@@ -135,7 +138,8 @@ public void GitConfiguration_TryGet_Name_Exists_ReturnsTrueOutString()
135
138
136
139
string gitPath = GetGitPath ( ) ;
137
140
var trace = new NullTrace ( ) ;
138
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
141
+ var env = new TestEnvironment ( ) ;
142
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
139
143
IGitConfiguration config = git . GetConfiguration ( ) ;
140
144
141
145
bool result = config . TryGet ( "user.name" , false , out string value ) ;
@@ -151,7 +155,8 @@ public void GitConfiguration_TryGet_Name_DoesNotExists_ReturnsFalse()
151
155
152
156
string gitPath = GetGitPath ( ) ;
153
157
var trace = new NullTrace ( ) ;
154
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
158
+ var env = new TestEnvironment ( ) ;
159
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
155
160
IGitConfiguration config = git . GetConfiguration ( ) ;
156
161
157
162
string randomName = $ "{ Guid . NewGuid ( ) : N} .{ Guid . NewGuid ( ) : N} ";
@@ -169,7 +174,8 @@ public void GitConfiguration_TryGet_IsPath_True_ReturnsCanonicalPath()
169
174
string homeDirectory = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ;
170
175
string gitPath = GetGitPath ( ) ;
171
176
var trace = new NullTrace ( ) ;
172
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
177
+ var env = new TestEnvironment ( ) ;
178
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
173
179
IGitConfiguration config = git . GetConfiguration ( ) ;
174
180
175
181
bool result = config . TryGet ( "example.path" , true , out string value ) ;
@@ -186,7 +192,8 @@ public void GitConfiguration_TryGet_IsPath_False_ReturnsRawConfig()
186
192
187
193
string gitPath = GetGitPath ( ) ;
188
194
var trace = new NullTrace ( ) ;
189
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
195
+ var env = new TestEnvironment ( ) ;
196
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
190
197
IGitConfiguration config = git . GetConfiguration ( ) ;
191
198
192
199
bool result = config . TryGet ( "example.path" , false , out string value ) ;
@@ -203,7 +210,8 @@ public void GitConfiguration_TryGet_BoolType_ReturnsCanonicalBool()
203
210
204
211
string gitPath = GetGitPath ( ) ;
205
212
var trace = new NullTrace ( ) ;
206
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
213
+ var env = new TestEnvironment ( ) ;
214
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
207
215
IGitConfiguration config = git . GetConfiguration ( ) ;
208
216
209
217
bool result = config . TryGet ( GitConfigurationLevel . Local , GitConfigurationType . Bool ,
@@ -221,7 +229,8 @@ public void GitConfiguration_TryGet_BoolWithoutType_ReturnsRawConfig()
221
229
222
230
string gitPath = GetGitPath ( ) ;
223
231
var trace = new NullTrace ( ) ;
224
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
232
+ var env = new TestEnvironment ( ) ;
233
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
225
234
IGitConfiguration config = git . GetConfiguration ( ) ;
226
235
227
236
bool result = config . TryGet ( GitConfigurationLevel . Local , GitConfigurationType . Raw ,
@@ -239,7 +248,8 @@ public void GitConfiguration_Get_Name_Exists_ReturnsString()
239
248
240
249
string gitPath = GetGitPath ( ) ;
241
250
var trace = new NullTrace ( ) ;
242
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
251
+ var env = new TestEnvironment ( ) ;
252
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
243
253
IGitConfiguration config = git . GetConfiguration ( ) ;
244
254
245
255
string value = config . Get ( "user.name" ) ;
@@ -254,7 +264,8 @@ public void GitConfiguration_Get_Name_DoesNotExists_ThrowsException()
254
264
255
265
string gitPath = GetGitPath ( ) ;
256
266
var trace = new NullTrace ( ) ;
257
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
267
+ var env = new TestEnvironment ( ) ;
268
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
258
269
IGitConfiguration config = git . GetConfiguration ( ) ;
259
270
260
271
string randomName = $ "{ Guid . NewGuid ( ) : N} .{ Guid . NewGuid ( ) : N} ";
@@ -268,7 +279,8 @@ public void GitConfiguration_Set_Local_SetsLocalConfig()
268
279
269
280
string gitPath = GetGitPath ( ) ;
270
281
var trace = new NullTrace ( ) ;
271
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
282
+ var env = new TestEnvironment ( ) ;
283
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
272
284
IGitConfiguration config = git . GetConfiguration ( ) ;
273
285
274
286
config . Set ( GitConfigurationLevel . Local , "core.foobar" , "foo123" ) ;
@@ -285,7 +297,8 @@ public void GitConfiguration_Set_All_ThrowsException()
285
297
286
298
string gitPath = GetGitPath ( ) ;
287
299
var trace = new NullTrace ( ) ;
288
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
300
+ var env = new TestEnvironment ( ) ;
301
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
289
302
IGitConfiguration config = git . GetConfiguration ( ) ;
290
303
291
304
Assert . Throws < InvalidOperationException > ( ( ) => config . Set ( GitConfigurationLevel . All , "core.foobar" , "test123" ) ) ;
@@ -303,7 +316,8 @@ public void GitConfiguration_Unset_Global_UnsetsGlobalConfig()
303
316
304
317
string gitPath = GetGitPath ( ) ;
305
318
var trace = new NullTrace ( ) ;
306
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
319
+ var env = new TestEnvironment ( ) ;
320
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
307
321
IGitConfiguration config = git . GetConfiguration ( ) ;
308
322
309
323
config . Unset ( GitConfigurationLevel . Global , "core.foobar" ) ;
@@ -333,7 +347,8 @@ public void GitConfiguration_Unset_Local_UnsetsLocalConfig()
333
347
334
348
string gitPath = GetGitPath ( ) ;
335
349
var trace = new NullTrace ( ) ;
336
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
350
+ var env = new TestEnvironment ( ) ;
351
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
337
352
IGitConfiguration config = git . GetConfiguration ( ) ;
338
353
339
354
config . Unset ( GitConfigurationLevel . Local , "core.foobar" ) ;
@@ -358,7 +373,8 @@ public void GitConfiguration_Unset_All_ThrowsException()
358
373
359
374
string gitPath = GetGitPath ( ) ;
360
375
var trace = new NullTrace ( ) ;
361
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
376
+ var env = new TestEnvironment ( ) ;
377
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
362
378
IGitConfiguration config = git . GetConfiguration ( ) ;
363
379
364
380
Assert . Throws < InvalidOperationException > ( ( ) => config . Unset ( GitConfigurationLevel . All , "core.foobar" ) ) ;
@@ -374,7 +390,8 @@ public void GitConfiguration_UnsetAll_UnsetsAllConfig()
374
390
375
391
string gitPath = GetGitPath ( ) ;
376
392
var trace = new NullTrace ( ) ;
377
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
393
+ var env = new TestEnvironment ( ) ;
394
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
378
395
IGitConfiguration config = git . GetConfiguration ( ) ;
379
396
380
397
config . UnsetAll ( GitConfigurationLevel . Local , "core.foobar" , "foo*" ) ;
@@ -391,7 +408,8 @@ public void GitConfiguration_UnsetAll_All_ThrowsException()
391
408
392
409
string gitPath = GetGitPath ( ) ;
393
410
var trace = new NullTrace ( ) ;
394
- var git = new GitProcess ( trace , gitPath , repoPath ) ;
411
+ var env = new TestEnvironment ( ) ;
412
+ var git = new GitProcess ( trace , env , gitPath , repoPath ) ;
395
413
IGitConfiguration config = git . GetConfiguration ( ) ;
396
414
397
415
Assert . Throws < InvalidOperationException > ( ( ) => config . UnsetAll ( GitConfigurationLevel . All , "core.foobar" , Constants . RegexPatterns . Any ) ) ;
0 commit comments