@@ -153,8 +153,9 @@ public async Task CreateGetAndCancelBatchProtocol()
153153 Assert . That ( status , Is . EqualTo ( "validating" ) ) ;
154154 }
155155
156- [ Test ]
157- public async Task CanRehydrateBatchOperation ( )
156+ [ TestCase ( true ) ]
157+ [ TestCase ( false ) ]
158+ public async Task CanRehydrateBatchOperation ( bool useBatchId )
158159 {
159160 using MemoryStream testFileStream = new ( ) ;
160161 using StreamWriter streamWriter = new ( testFileStream ) ;
@@ -183,13 +184,22 @@ public async Task CanRehydrateBatchOperation()
183184 ? await client . CreateBatchAsync ( content , waitUntilCompleted : false )
184185 : client . CreateBatch ( content , waitUntilCompleted : false ) ;
185186
186- // Simulate rehydration of the operation
187- BinaryData rehydrationBytes = batchOperation . RehydrationToken . ToBytes ( ) ;
188- ContinuationToken rehydrationToken = ContinuationToken . FromBytes ( rehydrationBytes ) ;
189-
190- CreateBatchOperation rehydratedOperation = IsAsync ?
191- await CreateBatchOperation . RehydrateAsync ( client , rehydrationToken ) :
192- CreateBatchOperation . Rehydrate ( client , rehydrationToken ) ;
187+ CreateBatchOperation rehydratedOperation ;
188+ if ( useBatchId )
189+ {
190+ rehydratedOperation = IsAsync ?
191+ await CreateBatchOperation . RehydrateAsync ( client , batchOperation . BatchId ) :
192+ CreateBatchOperation . Rehydrate ( client , batchOperation . BatchId ) ;
193+ }
194+ else {
195+ // Simulate rehydration of the operation
196+ BinaryData rehydrationBytes = batchOperation . RehydrationToken . ToBytes ( ) ;
197+ ContinuationToken rehydrationToken = ContinuationToken . FromBytes ( rehydrationBytes ) ;
198+
199+ rehydratedOperation = IsAsync ?
200+ await CreateBatchOperation . RehydrateAsync ( client , rehydrationToken ) :
201+ CreateBatchOperation . Rehydrate ( client , rehydrationToken ) ;
202+ }
193203
194204 static bool Validate ( CreateBatchOperation operation )
195205 {
0 commit comments