@@ -265,25 +265,28 @@ public void AnyPropertyChange_SetsDirty(string propertyName)
265265 [ Fact ]
266266 public async Task SaveCommand_MigratesModelPath_WhenChanged ( )
267267 {
268+ var oldPath = Path . Combine ( Path . GetTempPath ( ) , "old-models" ) ;
269+ var newPath = Path . Combine ( Path . GetTempPath ( ) , "new-models" ) ;
268270 var svc = CreateSettings ( new UserSettings
269271 {
270- Advanced = new AdvancedSettings { ModelStoragePath = @"C:\old" }
272+ Advanced = new AdvancedSettings { ModelStoragePath = oldPath }
271273 } ) ;
272274 var modelManager = Substitute . For < IModelManager > ( ) ;
273275 var vm = new SettingsViewModel ( svc , modelManager ) ;
274276
275- vm . ModelStoragePath = @"D:\new" ;
277+ vm . ModelStoragePath = newPath ;
276278 await vm . SaveCommand . ExecuteAsync ( null ) ;
277279
278- await modelManager . Received ( 1 ) . MigrateStoragePathAsync ( @"D:\new" , Arg . Any < CancellationToken > ( ) ) ;
280+ await modelManager . Received ( 1 ) . MigrateStoragePathAsync ( newPath , Arg . Any < CancellationToken > ( ) ) ;
279281 }
280282
281283 [ Fact ]
282284 public async Task SaveCommand_SkipsMigration_WhenPathUnchanged ( )
283285 {
286+ var samePath = Path . Combine ( Path . GetTempPath ( ) , "same-models" ) ;
284287 var svc = CreateSettings ( new UserSettings
285288 {
286- Advanced = new AdvancedSettings { ModelStoragePath = @"C:\same" }
289+ Advanced = new AdvancedSettings { ModelStoragePath = samePath }
287290 } ) ;
288291 var modelManager = Substitute . For < IModelManager > ( ) ;
289292 var vm = new SettingsViewModel ( svc , modelManager ) ;
@@ -296,14 +299,15 @@ public async Task SaveCommand_SkipsMigration_WhenPathUnchanged()
296299 [ Fact ]
297300 public async Task SaveCommand_SkipsMigration_WhenPathFormatOnlyDiffers ( )
298301 {
302+ var basePath = Path . Combine ( Path . GetTempPath ( ) , "models" ) ;
299303 var svc = CreateSettings ( new UserSettings
300304 {
301- Advanced = new AdvancedSettings { ModelStoragePath = @"C:\models" }
305+ Advanced = new AdvancedSettings { ModelStoragePath = basePath }
302306 } ) ;
303307 var modelManager = Substitute . For < IModelManager > ( ) ;
304308 var vm = new SettingsViewModel ( svc , modelManager ) ;
305- vm . OverlayHotkey = "Ctrl+Alt+Y" ; // make dirty
306- vm . ModelStoragePath = @"C:\models\" ;
309+ vm . OverlayHotkey = "Ctrl+Alt+Y" ;
310+ vm . ModelStoragePath = basePath + Path . DirectorySeparatorChar ;
307311
308312 await vm . SaveCommand . ExecuteAsync ( null ) ;
309313
@@ -325,16 +329,18 @@ public void Constructor_WithModelManager_PopulatesModels()
325329 [ Fact ]
326330 public async Task SaveCommand_SetsMigrationError_OnFailure ( )
327331 {
332+ var oldPath = Path . Combine ( Path . GetTempPath ( ) , "old-models" ) ;
333+ var newPath = Path . Combine ( Path . GetTempPath ( ) , "new-models" ) ;
328334 var svc = CreateSettings ( new UserSettings
329335 {
330- Advanced = new AdvancedSettings { ModelStoragePath = @"C:\old" }
336+ Advanced = new AdvancedSettings { ModelStoragePath = oldPath }
331337 } ) ;
332338 var modelManager = Substitute . For < IModelManager > ( ) ;
333339 modelManager . MigrateStoragePathAsync ( Arg . Any < string > ( ) , Arg . Any < CancellationToken > ( ) )
334340 . Returns ( Task . FromException ( new IOException ( "Access denied" ) ) ) ;
335341 var vm = new SettingsViewModel ( svc , modelManager ) ;
336342
337- vm . ModelStoragePath = @"D:\new" ;
343+ vm . ModelStoragePath = newPath ;
338344 await vm . SaveCommand . ExecuteAsync ( null ) ;
339345
340346 Assert . Contains ( "Access denied" , vm . MigrationError ) ;
@@ -344,14 +350,16 @@ public async Task SaveCommand_SetsMigrationError_OnFailure()
344350 [ Fact ]
345351 public async Task SaveCommand_ClearsMigrationError_OnSuccess ( )
346352 {
353+ var oldPath = Path . Combine ( Path . GetTempPath ( ) , "old-models" ) ;
354+ var newPath = Path . Combine ( Path . GetTempPath ( ) , "new-models" ) ;
347355 var svc = CreateSettings ( new UserSettings
348356 {
349- Advanced = new AdvancedSettings { ModelStoragePath = @"C:\old" }
357+ Advanced = new AdvancedSettings { ModelStoragePath = oldPath }
350358 } ) ;
351359 var modelManager = Substitute . For < IModelManager > ( ) ;
352360 var vm = new SettingsViewModel ( svc , modelManager ) ;
353361
354- vm . ModelStoragePath = @"D:\new" ;
362+ vm . ModelStoragePath = newPath ;
355363 await vm . SaveCommand . ExecuteAsync ( null ) ;
356364
357365 Assert . Null ( vm . MigrationError ) ;
0 commit comments