33
44using System ;
55using System . Collections . Generic ;
6+ using System . IO ;
67using System . Linq ;
78using System . Threading ;
89using System . Threading . Tasks ;
@@ -200,24 +201,30 @@ public async Task Handle_ChangedConfigurationOutputPath_StartsWithNewPath()
200201 _directoryPathResolver ,
201202 Enumerable . Empty < IProjectConfigurationFileChangeListener > ( ) ,
202203 LoggerFactory ) ;
204+
205+ var debugDirectory = Path . Combine ( "C:" , "externaldir" , "obj" , "Debug" ) ;
206+ var releaseDirectory = Path . Combine ( "C:" , "externaldir" , "obj" , "Release" ) ;
207+
203208 var debugOutputPath = new MonitorProjectConfigurationFilePathParams ( )
204209 {
205210 ProjectKeyId = TestProjectKey . Create ( "C:/dir/obj" ) . Id ,
206- ConfigurationFilePath = "C: \\ externaldir \\ obj \\ Debug \\ project.razor.bin",
211+ ConfigurationFilePath = Path . Combine ( debugDirectory , " project.razor.bin")
207212 } ;
213+
208214 var releaseOutputPath = new MonitorProjectConfigurationFilePathParams ( )
209215 {
210216 ProjectKeyId = debugOutputPath . ProjectKeyId ,
211- ConfigurationFilePath = "C: \\ externaldir \\ obj \\ Release \\ project.razor.bin",
217+ ConfigurationFilePath = Path . Combine ( releaseDirectory , " project.razor.bin")
212218 } ;
219+
213220 var requestContext = CreateRazorRequestContext ( documentContext : null ) ;
214221
215222 // Act
216223 await configurationFileEndpoint . HandleNotificationAsync ( debugOutputPath , requestContext , DisposalToken ) ;
217224 await configurationFileEndpoint . HandleNotificationAsync ( releaseOutputPath , requestContext , DisposalToken ) ;
218225
219226 // Assert
220- Assert . Equal ( new [ ] { "C: \\ externaldir \\ obj \\ Debug" , "C: \\ externaldir \\ obj \\ Release" } , detector . StartedWithDirectory ) ;
227+ Assert . Equal ( [ debugDirectory , releaseDirectory ] , detector . StartedWithDirectory ) ;
221228 Assert . Equal ( 1 , detector . StopCount ) ;
222229 }
223230
@@ -232,24 +239,30 @@ public async Task Handle_ChangedConfigurationExternalToInternal_StopsWithoutRest
232239 _directoryPathResolver ,
233240 Enumerable . Empty < IProjectConfigurationFileChangeListener > ( ) ,
234241 LoggerFactory ) ;
242+
243+ var debugDirectory = Path . Combine ( "C:" , "externaldir" , "obj" , "Debug" ) ;
244+ var releaseDirectory = Path . Combine ( "C:" , "dir" , "obj" , "Release" ) ;
245+
235246 var externalRequest = new MonitorProjectConfigurationFilePathParams ( )
236247 {
237248 ProjectKeyId = TestProjectKey . Create ( "C:\\ dir\\ obj" ) . Id ,
238- ConfigurationFilePath = "C: \\ externaldir \\ obj \\ Debug \\ project.razor.bin",
249+ ConfigurationFilePath = Path . Combine ( debugDirectory , " project.razor.bin")
239250 } ;
251+
240252 var internalRequest = new MonitorProjectConfigurationFilePathParams ( )
241253 {
242254 ProjectKeyId = externalRequest . ProjectKeyId ,
243- ConfigurationFilePath = "C: \\ dir \\ obj \\ Release \\ project.razor.bin",
255+ ConfigurationFilePath = Path . Combine ( releaseDirectory , " project.razor.bin")
244256 } ;
257+
245258 var requestContext = CreateRazorRequestContext ( documentContext : null ) ;
246259
247260 // Act
248261 await configurationFileEndpoint . HandleNotificationAsync ( externalRequest , requestContext , DisposalToken ) ;
249262 await configurationFileEndpoint . HandleNotificationAsync ( internalRequest , requestContext , DisposalToken ) ;
250263
251264 // Assert
252- Assert . Equal ( new [ ] { "C: \\ externaldir \\ obj \\ Debug" } , detector . StartedWithDirectory ) ;
265+ Assert . Equal ( [ debugDirectory ] , detector . StartedWithDirectory ) ;
253266 Assert . Equal ( 1 , detector . StopCount ) ;
254267 }
255268
@@ -268,16 +281,22 @@ public async Task Handle_ProjectPublished()
268281 _directoryPathResolver ,
269282 Enumerable . Empty < IProjectConfigurationFileChangeListener > ( ) ,
270283 LoggerFactory ) ;
284+
285+ var debugDirectory = Path . Combine ( "C:" , "externaldir1" , "obj" , "Debug" ) ;
286+ var releaseDirectory = Path . Combine ( "C:" , "externaldir1" , "obj" , "Release" ) ;
287+
271288 var debugOutputPath = new MonitorProjectConfigurationFilePathParams ( )
272289 {
273290 ProjectKeyId = TestProjectKey . Create ( "C:\\ dir\\ obj" ) . Id ,
274- ConfigurationFilePath = "C: \\ externaldir1 \\ obj \\ Debug \\ project.razor.bin",
291+ ConfigurationFilePath = Path . Combine ( debugDirectory , " project.razor.bin")
275292 } ;
293+
276294 var releaseOutputPath = new MonitorProjectConfigurationFilePathParams ( )
277295 {
278296 ProjectKeyId = debugOutputPath . ProjectKeyId ,
279- ConfigurationFilePath = "C: \\ externaldir1 \\ obj \\ Release \\ project.razor.bin",
297+ ConfigurationFilePath = Path . Combine ( releaseDirectory , " project.razor.bin")
280298 } ;
299+
281300 var requestContext = CreateRazorRequestContext ( documentContext : null ) ;
282301
283302 // Act
@@ -315,21 +334,29 @@ public async Task Handle_MultipleProjects_StartedAndStopped()
315334 _directoryPathResolver ,
316335 Enumerable . Empty < IProjectConfigurationFileChangeListener > ( ) ,
317336 LoggerFactory ) ;
337+
338+ var debugDirectory1 = Path . Combine ( "C:" , "externaldir1" , "obj" , "Debug" ) ;
339+ var releaseDirectory1 = Path . Combine ( "C:" , "externaldir1" , "obj" , "Release" ) ;
340+ var debugDirectory2 = Path . Combine ( "C:" , "externaldir2" , "obj" , "Debug" ) ;
341+
318342 var debugOutputPath1 = new MonitorProjectConfigurationFilePathParams ( )
319343 {
320344 ProjectKeyId = TestProjectKey . Create ( "C:\\ dir\\ obj" ) . Id ,
321- ConfigurationFilePath = "C: \\ externaldir1 \\ obj \\ Debug \\ project.razor.bin",
345+ ConfigurationFilePath = Path . Combine ( debugDirectory1 , " project.razor.bin")
322346 } ;
347+
323348 var releaseOutputPath1 = new MonitorProjectConfigurationFilePathParams ( )
324349 {
325350 ProjectKeyId = debugOutputPath1 . ProjectKeyId ,
326- ConfigurationFilePath = "C: \\ externaldir1 \\ obj \\ Release \\ project.razor.bin",
351+ ConfigurationFilePath = Path . Combine ( releaseDirectory1 , " project.razor.bin")
327352 } ;
353+
328354 var debugOutputPath2 = new MonitorProjectConfigurationFilePathParams ( )
329355 {
330356 ProjectKeyId = TestProjectKey . Create ( "C:\\ dir\\ obj2" ) . Id ,
331- ConfigurationFilePath = "C: \\ externaldir2 \\ obj \\ Debug \\ project.razor.bin",
357+ ConfigurationFilePath = Path . Combine ( debugDirectory2 , " project.razor.bin")
332358 } ;
359+
333360 var requestContext = CreateRazorRequestContext ( documentContext : null ) ;
334361
335362 // Act
0 commit comments