File tree Expand file tree Collapse file tree 5 files changed +9
-13
lines changed
src/AWS.Lambda.Powertools.Idempotency/Internal
tests/AWS.Lambda.Powertools.Idempotency.Tests Expand file tree Collapse file tree 5 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ namespace AWS.Lambda.Powertools.Idempotency.Internal;
1111/// </summary>
1212/// <typeparam name="TKey">The type of the key to the cached item.</typeparam>
1313/// <typeparam name="TValue">The type of the cached item.</typeparam>
14+ // ReSharper disable once InconsistentNaming
1415internal sealed class LRUCache < TKey , TValue >
1516{
1617 /// <summary>
Original file line number Diff line number Diff line change 2121using System . Threading . Tasks ;
2222using Amazon . DynamoDBv2 ;
2323using Amazon . Lambda . APIGatewayEvents ;
24- using Amazon . Lambda . Core ;
2524
2625namespace AWS . Lambda . Powertools . Idempotency . Tests . Handlers ;
2726
@@ -45,15 +44,15 @@ public IdempotencyFunction(AmazonDynamoDBClient client)
4544 }
4645
4746 [ Idempotent ]
48- public async Task < APIGatewayProxyResponse > Handle ( APIGatewayProxyRequest apigProxyEvent , ILambdaContext context )
47+ public async Task < APIGatewayProxyResponse > Handle ( APIGatewayProxyRequest apigProxyEvent )
4948 {
5049 HandlerExecuted = true ;
5150
52- var result = await InternalFunctionHandler ( apigProxyEvent , context ) ;
51+ var result = await InternalFunctionHandler ( apigProxyEvent ) ;
5352
5453 return result ;
5554 }
56- private async Task < APIGatewayProxyResponse > InternalFunctionHandler ( APIGatewayProxyRequest apigProxyEvent , ILambdaContext context )
55+ private async Task < APIGatewayProxyResponse > InternalFunctionHandler ( APIGatewayProxyRequest apigProxyEvent )
5756 {
5857 Dictionary < string , string > headers = new ( )
5958 {
Original file line number Diff line number Diff line change 1919using Amazon . DynamoDBv2 ;
2020using Amazon . DynamoDBv2 . Model ;
2121using Amazon . Lambda . APIGatewayEvents ;
22- using Amazon . Lambda . TestUtilities ;
2322using AWS . Lambda . Powertools . Idempotency . Tests . Handlers ;
2423using AWS . Lambda . Powertools . Idempotency . Tests . Persistence ;
2524using FluentAssertions ;
@@ -49,16 +48,14 @@ public async Task EndToEndTest()
4948 PropertyNameCaseInsensitive = true
5049 } ;
5150
52- //var persistenceStore = new InMemoryPersistenceStore();
53- var context = new TestLambdaContext ( ) ;
5451 var request = JsonSerializer . Deserialize < APIGatewayProxyRequest > ( await File . ReadAllTextAsync ( "./resources/apigw_event2.json" ) , options ) ;
5552
56- var response = await function . Handle ( request , context ) ;
53+ var response = await function . Handle ( request ) ;
5754 function . HandlerExecuted . Should ( ) . BeTrue ( ) ;
5855
5956 function . HandlerExecuted = false ;
6057
61- var response2 = await function . Handle ( request , context ) ;
58+ var response2 = await function . Handle ( request ) ;
6259 function . HandlerExecuted . Should ( ) . BeFalse ( ) ;
6360
6461 JsonSerializer . Serialize ( response ) . Should ( ) . Be ( JsonSerializer . Serialize ( response ) ) ;
Original file line number Diff line number Diff line change 2121//Source: https://github.dev/microsoft/botbuilder-dotnet/blob/main/tests/AdaptiveExpressions.Tests/LRUCacheTest.cs
2222namespace AWS . Lambda . Powertools . Idempotency . Tests . Internal ;
2323
24+ // ReSharper disable once InconsistentNaming
2425public class LRUCacheTests
2526{
2627 [ Fact ]
@@ -58,7 +59,7 @@ public void TestDiacardPolicy()
5859 /*
5960 * The average time of this test is about 2ms.
6061 */
61- public void TestDPMemorySmall ( )
62+ public void TestDpMemorySmall ( )
6263 {
6364 var cache = new LRUCache < int , int > ( 2 ) ;
6465 cache . Set ( 0 , 1 ) ;
@@ -87,7 +88,7 @@ public void TestDPMemorySmall()
8788 * The average time of this test is about 3ms.
8889 */
8990 [ Fact ]
90- public void TestDPMemoryLarge ( )
91+ public void TestDpMemoryLarge ( )
9192 {
9293 var cache = new LRUCache < int , int > ( 500 ) ;
9394 cache . Set ( 0 , 1 ) ;
@@ -123,7 +124,6 @@ public async Task TestMultiThreadingAsync()
123124 const int numOfOps = 1000 ;
124125 for ( var i = 0 ; i < numOfThreads ; i ++ )
125126 {
126- var idx = i ;
127127 tasks . Add ( Task . Run ( ( ) => StoreElement ( cache , numOfOps ) ) ) ;
128128 }
129129
Original file line number Diff line number Diff line change 1818using Amazon . DynamoDBv2 ;
1919using Amazon . DynamoDBv2 . Model ;
2020using Amazon . Runtime ;
21- using AWS . Lambda . Powertools . Idempotency . Persistence ;
2221using DotNet . Testcontainers . Builders ;
2322using DotNet . Testcontainers . Containers ;
2423
You can’t perform that action at this time.
0 commit comments