@@ -53,7 +53,7 @@ public async Task SendBatchAsync_200_DeletesFilesFromDisk()
5353 _store . Write ( "{\" type\" :\" track\" ,\" eventName\" :\" b\" }" ) ;
5454
5555 var handler = new MockHandler ( HttpStatusCode . OK , $ "{{\" accepted\" :2,\" { ResponseFields . Rejected } \" :0}}") ;
56- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" , handler : handler ) ;
56+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey , handler : handler ) ;
5757
5858 var sent = await transport . SendBatchAsync ( ) ;
5959
@@ -80,11 +80,11 @@ public async Task SendBatchAsync_200_SendsGzippedPayloadWithCorrectHeaders()
8080 capturedContentEncoding = string . Join ( "" , req . Content . Headers . ContentEncoding ) ;
8181 capturedBody = req . Content . ReadAsByteArrayAsync ( ) . Result ;
8282 } ) ;
83- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" , handler : handler ) ;
83+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey , handler : handler ) ;
8484
8585 await transport . SendBatchAsync ( ) ;
8686
87- Assert . AreEqual ( "pk_imapik-test-key1" , capturedKey ) ;
87+ Assert . AreEqual ( TestDefaults . PublishableKey , capturedKey ) ;
8888 Assert . AreEqual ( Constants . MediaTypeJson , capturedContentType ) ;
8989 Assert . AreEqual ( Constants . GzipEncoding , capturedContentEncoding ) ;
9090
@@ -111,11 +111,11 @@ public async Task SendBatchAsync_200_SendsPlainJsonPayloadWithoutContentEncoding
111111 capturedContentEncodingCount = req . Content . Headers . ContentEncoding . Count ;
112112 capturedBody = req . Content . ReadAsStringAsync ( ) . Result ;
113113 } ) ;
114- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" , handler : handler ) ;
114+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey , handler : handler ) ;
115115
116116 await transport . SendBatchAsync ( ) ;
117117
118- Assert . AreEqual ( "pk_imapik-test-key1" , capturedKey ) ;
118+ Assert . AreEqual ( TestDefaults . PublishableKey , capturedKey ) ;
119119 Assert . AreEqual ( Constants . MediaTypeJson , capturedContentType ) ;
120120 Assert . AreEqual ( 0 , capturedContentEncodingCount , "no Content-Encoding header is permitted in v1" ) ;
121121 StringAssert . StartsWith ( $ "{{\" { ResponseFields . MessagesEnvelope } \" :[", capturedBody ) ;
@@ -132,7 +132,7 @@ public async Task SendBatchAsync_200_UsesCorrectUrlForTestKey()
132132 HttpRequestMessage ? captured = null ;
133133 var handler = new MockHandler ( HttpStatusCode . OK , $ "{{\" accepted\" :1,\" { ResponseFields . Rejected } \" :0}}",
134134 onRequest : req => captured = req ) ;
135- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" , handler : handler ) ;
135+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey , handler : handler ) ;
136136
137137 await transport . SendBatchAsync ( ) ;
138138
@@ -165,7 +165,7 @@ public async Task SendBatchAsync_BaseUrlOverride_WinsOverKeyPrefix()
165165 const string custom = "https://api.dev.immutable.com" ;
166166 // Test-prefixed key would resolve to Sandbox on its own; the
167167 // explicit override must win.
168- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
168+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
169169 baseUrlOverride : custom , handler : handler ) ;
170170
171171 await transport . SendBatchAsync ( ) ;
@@ -177,7 +177,7 @@ public async Task SendBatchAsync_BaseUrlOverride_WinsOverKeyPrefix()
177177 public async Task SendBatchAsync_EmptyQueue_ReturnsFalse ( )
178178 {
179179 var handler = new MockHandler ( HttpStatusCode . OK , "{}" ) ;
180- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" , handler : handler ) ;
180+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey , handler : handler ) ;
181181
182182 var sent = await transport . SendBatchAsync ( ) ;
183183
@@ -192,7 +192,7 @@ public async Task SendBatchAsync_4xx_DeletesFilesAndResetsBackoff()
192192
193193 var handler = new MockHandler ( HttpStatusCode . BadRequest , "" ) ;
194194 AudienceError ? reportedError = null ;
195- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
195+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
196196 onError : e => reportedError = e , handler : handler ) ;
197197
198198 await transport . SendBatchAsync ( ) ;
@@ -210,7 +210,7 @@ public async Task SendBatchAsync_429_NoRetryAfter_KeepsFilesAndUsesExpoBackoff_N
210210
211211 var handler = new MockHandler ( ( HttpStatusCode ) 429 , "" ) ;
212212 AudienceError ? reportedError = null ;
213- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
213+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
214214 onError : e => reportedError = e , handler : handler , getUtcNow : _getUtcNow ) ;
215215
216216 await transport . SendBatchAsync ( ) ;
@@ -232,7 +232,7 @@ public async Task SendBatchAsync_429_RetryAfterDeltaSeconds_OverridesExpoBackoff
232232 resp . Headers . Add ( "Retry-After" , "12" ) ;
233233 return resp ;
234234 } ) ;
235- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
235+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
236236 handler : handler , getUtcNow : _getUtcNow ) ;
237237
238238 await transport . SendBatchAsync ( ) ;
@@ -255,7 +255,7 @@ public async Task SendBatchAsync_429_RetryAfterHttpDate_OverridesExpoBackoff()
255255 resp . Headers . Add ( "Retry-After" , DateTimeOffset . UtcNow . AddSeconds ( 20 ) . ToString ( "R" ) ) ;
256256 return resp ;
257257 } ) ;
258- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
258+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
259259 handler : handler , getUtcNow : _getUtcNow ) ;
260260
261261 await transport . SendBatchAsync ( ) ;
@@ -277,7 +277,7 @@ public async Task SendBatchAsync_429_PastRetryAfterDate_FallsBackToExpoBackoff()
277277 resp . Headers . Add ( "Retry-After" , DateTimeOffset . UtcNow . AddSeconds ( - 30 ) . ToString ( "R" ) ) ;
278278 return resp ;
279279 } ) ;
280- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
280+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
281281 handler : handler , getUtcNow : _getUtcNow ) ;
282282
283283 await transport . SendBatchAsync ( ) ;
@@ -301,7 +301,7 @@ public async Task SendBatchAsync_429ThenSuccess_DeliversBatchAndClearsBackoff()
301301 { Content = new StringContent ( $ "{{\" accepted\" :1,\" { ResponseFields . Rejected } \" :0}}") } ;
302302 } ) ;
303303 AudienceError ? reportedError = null ;
304- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
304+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
305305 onError : e => reportedError = e , handler : handler , getUtcNow : _getUtcNow ) ;
306306
307307 await transport . SendBatchAsync ( ) ;
@@ -327,7 +327,7 @@ public async Task SendBatchAsync_200_WithRejected_DeletesFilesAndSurfacesValidat
327327
328328 var handler = new MockHandler ( HttpStatusCode . OK , $ "{{\" accepted\" :1,\" { ResponseFields . Rejected } \" :1}}") ;
329329 AudienceError ? reportedError = null ;
330- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
330+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
331331 onError : e => reportedError = e , handler : handler ) ;
332332
333333 await transport . SendBatchAsync ( ) ;
@@ -345,7 +345,7 @@ public async Task SendBatchAsync_200_ZeroRejected_DoesNotFireOnError()
345345
346346 var handler = new MockHandler ( HttpStatusCode . OK , $ "{{\" accepted\" :1,\" { ResponseFields . Rejected } \" :0}}") ;
347347 AudienceError ? reportedError = null ;
348- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
348+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
349349 onError : e => reportedError = e , handler : handler ) ;
350350
351351 await transport . SendBatchAsync ( ) ;
@@ -361,7 +361,7 @@ public async Task SendBatchAsync_200_MalformedBody_TreatsAsZeroRejected()
361361
362362 var handler = new MockHandler ( HttpStatusCode . OK , "not-json" ) ;
363363 AudienceError ? reportedError = null ;
364- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
364+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
365365 onError : e => reportedError = e , handler : handler ) ;
366366
367367 await transport . SendBatchAsync ( ) ;
@@ -377,7 +377,7 @@ public async Task SendBatchAsync_5xx_KeepsFilesAndIncreasesBackoff()
377377
378378 var handler = new MockHandler ( HttpStatusCode . InternalServerError , "" ) ;
379379 AudienceError ? reportedError = null ;
380- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
380+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
381381 onError : e => reportedError = e , handler : handler ) ;
382382
383383 await transport . SendBatchAsync ( ) ;
@@ -394,7 +394,7 @@ public async Task BackoffMs_EscalatesOnlyAfterWindowElapsed()
394394 {
395395 _store . Write ( "{\" type\" :\" track\" }" ) ;
396396 var handler = new MockHandler ( HttpStatusCode . InternalServerError , "" ) ;
397- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
397+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
398398 handler : handler , getUtcNow : _getUtcNow ) ;
399399
400400 // Schedule: 5s → 10s → 20s → 40s → 60s cap.
@@ -428,7 +428,7 @@ public async Task BackoffMs_DoesNotEscalateWhileInsidePreviousWindow()
428428 {
429429 _store . Write ( "{\" type\" :\" track\" }" ) ;
430430 var handler = new MockHandler ( HttpStatusCode . InternalServerError , "" ) ;
431- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
431+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
432432 handler : handler , getUtcNow : _getUtcNow ) ;
433433
434434 await transport . SendBatchAsync ( ) ;
@@ -470,7 +470,7 @@ public async Task BackoffMs_ResetsAfterSuccess()
470470 : new HttpResponseMessage ( HttpStatusCode . OK )
471471 { Content = new StringContent ( $ "{{\" accepted\" :1,\" { ResponseFields . Rejected } \" :0}}") } ;
472472 } ) ;
473- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
473+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
474474 handler : handler , getUtcNow : _getUtcNow ) ;
475475
476476 await transport . SendBatchAsync ( ) ;
@@ -493,7 +493,7 @@ public async Task SendBatchAsync_NetworkError_KeepsFilesAndBacksOff()
493493
494494 var handler = new MockHandler ( ( ) => throw new HttpRequestException ( "connection refused" ) ) ;
495495 AudienceError ? reportedError = null ;
496- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
496+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
497497 onError : e => reportedError = e , handler : handler ) ;
498498
499499 await transport . SendBatchAsync ( ) ;
@@ -516,7 +516,7 @@ public async Task SendBatchAsync_HttpClientTimeout_TreatedAsNetworkError()
516516
517517 var handler = new MockHandler ( ( ) => throw new TaskCanceledException ( "Request timed out" ) ) ;
518518 AudienceError ? reportedError = null ;
519- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
519+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
520520 onError : e => reportedError = e , handler : handler ) ;
521521
522522 // Pass default CancellationToken so ct.IsCancellationRequested is false; this
@@ -542,7 +542,7 @@ public async Task SendBatchAsync_CallerCancelled_Throws_DoesNotDeleteOrRecordFai
542542
543543 var handler = new MockHandler ( ( ) => throw new OperationCanceledException ( "simulated" ) ) ;
544544 AudienceError ? reportedError = null ;
545- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
545+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
546546 onError : e => reportedError = e , handler : handler ) ;
547547
548548 using var cts = new CancellationTokenSource ( ) ;
@@ -574,7 +574,7 @@ public async Task IsInBackoffWindow_ClearsAfterNextAttemptAtElapses()
574574
575575 var now = new DateTime ( 2026 , 4 , 17 , 12 , 0 , 0 , DateTimeKind . Utc ) ;
576576 var handler = new MockHandler ( HttpStatusCode . InternalServerError , "" ) ;
577- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
577+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
578578 handler : handler , getUtcNow : ( ) => now ) ;
579579
580580 await transport . SendBatchAsync ( ) ;
@@ -597,7 +597,7 @@ public async Task SendBatchAsync_ErrorCallbackThrows_DoesNotCrash()
597597 _store . Write ( "{\" type\" :\" track\" }" ) ;
598598
599599 var handler = new MockHandler ( HttpStatusCode . BadRequest , "" ) ;
600- using var transport = new HttpTransport ( _store , "pk_imapik-test-key1" ,
600+ using var transport = new HttpTransport ( _store , TestDefaults . PublishableKey ,
601601 onError : _ => throw new InvalidOperationException ( "callback bug" ) ,
602602 handler : handler ) ;
603603
0 commit comments