@@ -848,101 +848,5 @@ public async Task Configure_WhenFunctionNameIsWhitespace_ShouldUseDefaultFunctio
848848 dr . IdempotencyKey . Should ( ) . NotContain ( "testFunction. " ) ;
849849 }
850850
851- [ Fact ]
852- public async Task Configure_WhenCalledMultipleTimes_ShouldOnlyConfigureOnceButUpdateFunctionName ( )
853- {
854- // Arrange - This test covers the fast path: if (_isConfigured) { SetFullFunctionName(...); return; }
855- var persistenceStore = new InMemoryPersistenceStore ( ) ;
856- var request = LoadApiGatewayProxyRequest ( ) ;
857-
858- // First configuration
859- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( ) . Build ( ) , "firstFunction" , null ) ;
860-
861- var now = DateTimeOffset . UtcNow ;
862-
863- // Act - Call configure again with different function name (simulates multiple idempotent methods)
864- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( ) . Build ( ) , "secondFunction" , null ) ;
865- await persistenceStore . SaveInProgress ( JsonSerializer . SerializeToDocument ( request ) ! , now , null ) ;
866-
867- // Assert - Should use the second function name (SetFullFunctionName was called in fast path)
868- var dr = persistenceStore . DataRecord ;
869- dr . IdempotencyKey . Should ( ) . Contain ( "secondFunction" ) ;
870- dr . IdempotencyKey . Should ( ) . Be ( "testFunction.secondFunction#5eff007a9ed2789a9f9f6bc182fc6ae6" ) ;
871- }
872-
873- [ Fact ]
874- public async Task Configure_WhenCalledMultipleTimesWithKeyPrefix_ShouldUpdateKeyPrefix ( )
875- {
876- // Arrange - This test covers the fast path with keyPrefix: if (_isConfigured) { SetFullFunctionName(...); return; }
877- var persistenceStore = new InMemoryPersistenceStore ( ) ;
878- var request = LoadApiGatewayProxyRequest ( ) ;
879-
880- // First configuration with keyPrefix
881- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( ) . Build ( ) , "function" , "FirstPrefix" ) ;
882-
883- var now = DateTimeOffset . UtcNow ;
884-
885- // Act - Call configure again with different keyPrefix
886- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( ) . Build ( ) , "function" , "SecondPrefix" ) ;
887- await persistenceStore . SaveInProgress ( JsonSerializer . SerializeToDocument ( request ) ! , now , null ) ;
888-
889- // Assert - Should use the second keyPrefix
890- var dr = persistenceStore . DataRecord ;
891- dr . IdempotencyKey . Should ( ) . StartWith ( "SecondPrefix#" ) ;
892- dr . IdempotencyKey . Should ( ) . NotContain ( "FirstPrefix" ) ;
893- }
894-
895- [ Fact ]
896- public async Task Configure_InternalMethod_WhenCalledMultipleTimes_ShouldOnlyConfigureOnceButUpdateFunctionName ( )
897- {
898- // Arrange - This test covers the internal Configure method's fast path
899- var persistenceStore = new InMemoryPersistenceStore ( ) ;
900- var request = LoadApiGatewayProxyRequest ( ) ;
901- LRUCache < string , DataRecord > cache = new ( 2 ) ;
902-
903- // First configuration using internal method
904- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( )
905- . WithUseLocalCache ( true )
906- . Build ( ) , "firstFunction" , null , cache ) ;
907-
908- var now = DateTimeOffset . UtcNow ;
909-
910- // Act - Call configure again with different function name
911- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( )
912- . WithUseLocalCache ( true )
913- . Build ( ) , "secondFunction" , null , cache ) ;
914- await persistenceStore . SaveInProgress ( JsonSerializer . SerializeToDocument ( request ) ! , now , null ) ;
915-
916- // Assert - Should use the second function name
917- var dr = persistenceStore . DataRecord ;
918- dr . IdempotencyKey . Should ( ) . Contain ( "secondFunction" ) ;
919- }
920-
921- [ Fact ]
922- public async Task Configure_InternalMethod_WhenCalledMultipleTimesWithKeyPrefix_ShouldUpdateKeyPrefix ( )
923- {
924- // Arrange - This test covers the internal Configure method's fast path with keyPrefix
925- var persistenceStore = new InMemoryPersistenceStore ( ) ;
926- var request = LoadApiGatewayProxyRequest ( ) ;
927- LRUCache < string , DataRecord > cache = new ( 2 ) ;
928-
929- // First configuration with keyPrefix using internal method
930- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( )
931- . WithUseLocalCache ( true )
932- . Build ( ) , "function" , "FirstPrefix" , cache ) ;
933-
934- var now = DateTimeOffset . UtcNow ;
935-
936- // Act - Call configure again with different keyPrefix
937- persistenceStore . Configure ( new IdempotencyOptionsBuilder ( )
938- . WithUseLocalCache ( true )
939- . Build ( ) , "function" , "SecondPrefix" , cache ) ;
940- await persistenceStore . SaveInProgress ( JsonSerializer . SerializeToDocument ( request ) ! , now , null ) ;
941-
942- // Assert - Should use the second keyPrefix
943- var dr = persistenceStore . DataRecord ;
944- dr . IdempotencyKey . Should ( ) . StartWith ( "SecondPrefix#" ) ;
945- }
946-
947851 #endregion
948852}
0 commit comments