@@ -404,6 +404,59 @@ public void CorrelationId_Should_Return_Null_When_Not_Set()
404404 Assert . Null ( Logger . CorrelationId ) ;
405405 }
406406
407+ [ Fact ]
408+ public void OnEntry_WhenPropertyCasingDoesNotMatch_UsesCaseInsensitiveFallback ( )
409+ {
410+ // Arrange
411+ var correlationId = Guid . NewGuid ( ) . ToString ( ) ;
412+
413+ // This test uses a path "/detail/CORRELATIONID" (all caps)
414+ // but the actual property is "correlationId" (camelCase)
415+ // This should trigger the case-insensitive fallback
416+
417+ // Act
418+ _testHandlers . CorrelationIdCaseInsensitiveFallback ( new CloudWatchEvent < CwEvent >
419+ {
420+ Detail = new CwEvent
421+ {
422+ CorrelationId = correlationId
423+ }
424+ } ) ;
425+
426+ // Assert
427+ var allKeys = Logger . GetAllKeys ( )
428+ . ToDictionary ( keyValuePair => keyValuePair . Key , keyValuePair => keyValuePair . Value ) ;
429+
430+ Assert . True ( allKeys . ContainsKey ( LoggingConstants . KeyCorrelationId ) ) ;
431+ Assert . Equal ( ( string ) allKeys [ LoggingConstants . KeyCorrelationId ] , correlationId ) ;
432+ }
433+
434+ [ Fact ]
435+ public void OnEntry_WhenNestedPropertyCasingDoesNotMatch_UsesCaseInsensitiveFallback ( )
436+ {
437+ // Arrange
438+ var correlationId = Guid . NewGuid ( ) . ToString ( ) ;
439+
440+ // This test uses a path with mismatched casing at multiple levels
441+ // Path: "/DETAIL/CORRELATIONID" but actual properties are "detail" and "correlationId"
442+
443+ // Act
444+ _testHandlers . CorrelationIdNestedCaseInsensitive ( new CloudWatchEvent < CwEvent >
445+ {
446+ Detail = new CwEvent
447+ {
448+ CorrelationId = correlationId
449+ }
450+ } ) ;
451+
452+ // Assert
453+ var allKeys = Logger . GetAllKeys ( )
454+ . ToDictionary ( keyValuePair => keyValuePair . Key , keyValuePair => keyValuePair . Value ) ;
455+
456+ Assert . True ( allKeys . ContainsKey ( LoggingConstants . KeyCorrelationId ) ) ;
457+ Assert . Equal ( ( string ) allKeys [ LoggingConstants . KeyCorrelationId ] , correlationId ) ;
458+ }
459+
407460 [ Fact ]
408461 public void When_Setting_Service_Should_Update_Key ( )
409462 {
0 commit comments