1212using Sentry . Protocol . Envelopes ;
1313using Sentry . Testing ;
1414using Xunit ;
15+ using Xunit . Abstractions ;
1516
1617namespace Sentry . Tests . Internals . Http
1718{
1819 public class CachingTransportTests
1920 {
21+ private readonly IDiagnosticLogger _logger ;
22+
23+ public CachingTransportTests ( ITestOutputHelper testOutputHelper )
24+ {
25+ _logger = new TestOutputDiagnosticLogger ( testOutputHelper ) ;
26+ }
27+
2028 [ Fact ( Timeout = 7000 ) ]
2129 public async Task WorksInBackground ( )
2230 {
2331 // Arrange
2432 using var cacheDirectory = new TempDirectory ( ) ;
25- var options = new SentryOptions { CacheDirectoryPath = cacheDirectory . Path } ;
33+ var options = new SentryOptions
34+ {
35+ DiagnosticLogger = _logger ,
36+ CacheDirectoryPath = cacheDirectory . Path
37+ } ;
2638
2739 using var innerTransport = new FakeTransport ( ) ;
2840 await using var transport = new CachingTransport ( innerTransport , options ) ;
@@ -49,7 +61,11 @@ public async Task EnvelopeReachesInnerTransport()
4961 {
5062 // Arrange
5163 using var cacheDirectory = new TempDirectory ( ) ;
52- var options = new SentryOptions { CacheDirectoryPath = cacheDirectory . Path } ;
64+ var options = new SentryOptions
65+ {
66+ DiagnosticLogger = _logger ,
67+ CacheDirectoryPath = cacheDirectory . Path
68+ } ;
5369
5470 using var innerTransport = new FakeTransport ( ) ;
5571 await using var transport = new CachingTransport ( innerTransport , options ) ;
@@ -75,6 +91,7 @@ public async Task MaintainsLimit()
7591 using var cacheDirectory = new TempDirectory ( ) ;
7692 var options = new SentryOptions
7793 {
94+ DiagnosticLogger = _logger ,
7895 CacheDirectoryPath = cacheDirectory . Path ,
7996 MaxQueueItems = 2
8097 } ;
@@ -105,7 +122,11 @@ public async Task AwareOfExistingFiles()
105122 {
106123 // Arrange
107124 using var cacheDirectory = new TempDirectory ( ) ;
108- var options = new SentryOptions { CacheDirectoryPath = cacheDirectory . Path } ;
125+ var options = new SentryOptions
126+ {
127+ DiagnosticLogger = _logger ,
128+ CacheDirectoryPath = cacheDirectory . Path
129+ } ;
109130
110131 // Send some envelopes with a failing transport to make sure they all stay in cache
111132 {
@@ -144,7 +165,11 @@ public async Task DoesNotRetryOnNonTransientExceptions()
144165 {
145166 // Arrange
146167 using var cacheDirectory = new TempDirectory ( ) ;
147- var options = new SentryOptions { CacheDirectoryPath = cacheDirectory . Path } ;
168+ var options = new SentryOptions
169+ {
170+ DiagnosticLogger = _logger ,
171+ CacheDirectoryPath = cacheDirectory . Path
172+ } ;
148173
149174 var innerTransport = Substitute . For < ITransport > ( ) ;
150175 var isFailing = true ;
@@ -186,7 +211,11 @@ public async Task DoesNotDeleteCacheIfConnectionWithIssue()
186211 {
187212 // Arrange
188213 using var cacheDirectory = new TempDirectory ( ) ;
189- var options = new SentryOptions { CacheDirectoryPath = cacheDirectory . Path } ;
214+ var options = new SentryOptions
215+ {
216+ DiagnosticLogger = _logger ,
217+ CacheDirectoryPath = cacheDirectory . Path
218+ } ;
190219
191220 var exception = new HttpRequestException ( null , new SocketException ( ) ) ;
192221 var receivedException = new Exception ( ) ;
0 commit comments