@@ -261,45 +261,28 @@ public void TryRecoverPersistedSession_SessionNotStarted_ReturnsNull()
261261 }
262262
263263 [ Fact ]
264- public void TryRecoverPersistedSession_FileNotFoundException_LogDebug ( )
264+ public void TryRecoverPersistedSession_NoSessionFile_LogDebug ( )
265265 {
266266 // Arrange
267+ _fixture . PersistedSessionProvider = _ => throw new UnreachableException ( "Unexpected attempt to read a file that does not exist." ) ;
267268 var sut = _fixture . GetSut ( ) ;
268- sut = new GlobalSessionManager (
269- _fixture . Options ,
270- persistedSessionProvider : _ => throw new FileNotFoundException ( ) ) ;
271269
272270 // Act
273271 sut . TryRecoverPersistedSession ( ) ;
274272
275273 // Assert
276- _fixture . Logger . Entries . Should ( ) . Contain ( e => e . Level == SentryLevel . Debug ) ;
277- }
278-
279- [ Fact ]
280- public void TryRecoverPersistedSession_DirectoryNotFoundException_LogDebug ( )
281- {
282- // Arrange
283- var sut = _fixture . GetSut ( ) ;
284- sut = new GlobalSessionManager (
285- _fixture . Options ,
286- persistedSessionProvider : _ => throw new DirectoryNotFoundException ( ) ) ;
287-
288- // Act
289- sut . TryRecoverPersistedSession ( ) ;
290-
291- // Assert
292- _fixture . Logger . Entries . Should ( ) . Contain ( e => e . Level == SentryLevel . Debug ) ;
274+ _fixture . Logger . Entries . Should ( ) . Contain ( e =>
275+ e . Level == SentryLevel . Debug
276+ && e . Message . Contains ( "A persisted session file was not found" ) ) ;
293277 }
294278
295279 [ Fact ]
296280 public void TryRecoverPersistedSession_EndOfStreamException_LogError ( )
297281 {
298282 // Arrange
283+ _fixture . PersistedSessionProvider = _ => throw new EndOfStreamException ( ) ;
299284 var sut = _fixture . GetSut ( ) ;
300- sut = new GlobalSessionManager (
301- _fixture . Options ,
302- persistedSessionProvider : _ => throw new EndOfStreamException ( ) ) ;
285+ sut . StartSession ( ) ;
303286
304287 // Act
305288 sut . TryRecoverPersistedSession ( ) ;
@@ -391,6 +374,7 @@ public void TryRecoverPersistedSession_CrashDelegateReturnsTrueWithPauseTimestam
391374 pausedTimestamp ) ;
392375
393376 var sut = _fixture . GetSut ( ) ;
377+ sut . StartSession ( ) ;
394378
395379 // Act
396380 var persistedSessionUpdate = sut . TryRecoverPersistedSession ( ) ;
@@ -412,6 +396,7 @@ public void TryRecoverPersistedSession_CrashDelegateIsNullWithPauseTimestamp_End
412396 pausedTimestamp ) ;
413397
414398 var sut = _fixture . GetSut ( ) ;
399+ sut . StartSession ( ) ;
415400
416401 // Act
417402 var persistedSessionUpdate = sut . TryRecoverPersistedSession ( ) ;
@@ -568,6 +553,7 @@ public void TryRecoverPersistedSession_WithPendingUnhandledAndNoCrash_EndsAsUnha
568553 pendingUnhandled : true ) ;
569554
570555 var sut = _fixture . GetSut ( ) ;
556+ sut . StartSession ( ) ;
571557
572558 // Act
573559 var persistedSessionUpdate = sut . TryRecoverPersistedSession ( ) ;
@@ -588,6 +574,7 @@ public void TryRecoverPersistedSession_WithPendingUnhandledAndCrash_EscalatesToC
588574 pendingUnhandled : true ) ;
589575
590576 var sut = _fixture . GetSut ( ) ;
577+ sut . StartSession ( ) ;
591578
592579 // Act
593580 var persistedSessionUpdate = sut . TryRecoverPersistedSession ( ) ;
@@ -609,6 +596,7 @@ public void TryRecoverPersistedSession_WithPendingUnhandledAndPauseTimestamp_Esc
609596 pendingUnhandled : true ) ;
610597
611598 var sut = _fixture . GetSut ( ) ;
599+ sut . StartSession ( ) ;
612600
613601 // Act
614602 var persistedSessionUpdate = sut . TryRecoverPersistedSession ( ) ;
0 commit comments