@@ -60,11 +60,11 @@ public static void Test01Create()
6060 Assert . False ( j . Environment . Gc . AllowVeryLargeObjects ) ;
6161 Assert . Equal ( Platform . AnyCpu , j . Environment . Platform ) ;
6262 Assert . Equal ( RunStrategy . Throughput , j . Run . RunStrategy ) ; // set by default
63- Assert . Equal ( "Default " , j . Id ) ; // id reset
64- Assert . True ( j . DisplayInfo == "DefaultJob" , "DisplayInfo = " + j . DisplayInfo ) ;
65- Assert . True ( j . ResolvedId == "DefaultJob" , "ResolvedId = " + j . ResolvedId ) ;
63+ Assert . Equal ( "CustomId " , j . Id ) ; // id remains after unfreeze
64+ Assert . Equal ( "CustomId" , j . DisplayInfo ) ;
65+ Assert . Equal ( "CustomId" , j . ResolvedId ) ;
6666 Assert . Equal ( j . ResolvedId , j . FolderInfo ) ;
67- Assert . Equal ( "Default " , j . Environment . Id ) ;
67+ Assert . Equal ( "CustomId " , j . Environment . Id ) ; // id remains after unfreeze
6868
6969 // new job
7070 j = new Job ( j . Freeze ( ) ) ;
@@ -160,7 +160,7 @@ public static void Test02Modify()
160160 // 4. Freeze-unfreeze:
161161 j = j . Freeze ( ) . UnfreezeCopy ( ) ;
162162
163- Assert . Equal ( "Platform=X86, LaunchCount=1 " , j . Id ) ;
163+ Assert . Equal ( "SomeId " , j . Id ) ; // id not lost
164164 Assert . Equal ( Platform . X86 , j . Environment . Platform ) ;
165165 Assert . Equal ( 1 , j . Run . LaunchCount ) ;
166166
@@ -204,15 +204,15 @@ public static void Test03IdDoesNotFlow()
204204 Assert . False ( j . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
205205 Assert . False ( j . Environment . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
206206
207- Job . EnvironmentCharacteristic [ j ] = EnvironmentMode . LegacyJitX86 . UnfreezeCopy ( ) ; // id will not flow
208- Assert . False ( j . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
209- Assert . False ( j . Environment . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
207+ Job . EnvironmentCharacteristic [ j ] = EnvironmentMode . LegacyJitX86 . UnfreezeCopy ( ) ; // id will flow
208+ Assert . True ( j . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
209+ Assert . True ( j . Environment . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
210210
211211 var c = new CharacteristicSet ( EnvironmentMode . LegacyJitX64 , RunMode . Long ) ; // id will not flow, new CharacteristicSet
212212 Assert . False ( c . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
213213
214- Job . EnvironmentCharacteristic [ c ] = EnvironmentMode . LegacyJitX86 . UnfreezeCopy ( ) ; // id will not flow
215- Assert . False ( c . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
214+ Job . EnvironmentCharacteristic [ c ] = EnvironmentMode . LegacyJitX86 . UnfreezeCopy ( ) ; // id will flow
215+ Assert . True ( c . HasValue ( CharacteristicObject . IdCharacteristic ) ) ;
216216
217217 CharacteristicObject . IdCharacteristic [ c ] = "MyId" ; // id set explicitly
218218 Assert . Equal ( "MyId" , c . Id ) ;
@@ -221,12 +221,12 @@ public static void Test03IdDoesNotFlow()
221221 Assert . Equal ( "MyId" , j . Id ) ;
222222 Assert . Equal ( "MyId" , j . Environment . Id ) ;
223223
224- Job . EnvironmentCharacteristic [ j ] = EnvironmentMode . LegacyJitX86 . UnfreezeCopy ( ) ; // id will not flow
225- Assert . Equal ( "MyId " , j . Id ) ;
226- Assert . Equal ( "MyId " , j . Environment . Id ) ;
224+ Job . EnvironmentCharacteristic [ j ] = EnvironmentMode . LegacyJitX86 . UnfreezeCopy ( ) ;
225+ Assert . Equal ( "LegacyJitX86 " , j . Id ) ;
226+ Assert . Equal ( "LegacyJitX86 " , j . Environment . Id ) ;
227227
228- j = j . WithJit ( Jit . RyuJit ) ; // custom id will flow
229- Assert . Equal ( "MyId " , j . Id ) ;
228+ j = j . WithJit ( Jit . RyuJit ) ;
229+ Assert . Equal ( "LegacyJitX86 " , j . Id ) ;
230230 }
231231
232232 [ Fact ]
@@ -474,6 +474,20 @@ public static void WithNuGet()
474474 Assert . Equal ( expected , j . Infrastructure . NuGetReferences ) ; // ensure that the list's equality operator returns true when the contents are the same
475475 }
476476
477+ [ Fact ]
478+ public static void UnfreezeCopy_PreservesIdCharacteristic ( )
479+ {
480+ // Arrange
481+ var original = new Job ( ) ;
482+ original . SetValue ( Job . IdCharacteristic , "TestID" ) ;
483+
484+ // Act
485+ var copy = original . UnfreezeCopy ( ) ;
486+
487+ // Assert
488+ Assert . Equal ( "TestID" , copy . GetValue ( Job . IdCharacteristic ) ) ;
489+ }
490+
477491 private static bool IsSubclassOfobModeOfItself ( Type type )
478492 {
479493 Type jobModeOfT ;
0 commit comments