Skip to content

Commit b5b6060

Browse files
committed
merge and fix conflicts
2 parents d169fcd + 902d6a6 commit b5b6060

File tree

43 files changed

+3352
-3857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3352
-3857
lines changed

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ All notable changes to this project will be documented in this file.
77
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
88

99

10+
<a name="1.4.1"></a>
11+
## [1.4.1] - 2023-06-29
12+
## Maintenance
13+
14+
* remove GH pages
15+
16+
## Pull Requests
17+
18+
* Merge pull request [#318](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/318) from aws-powertools/hjgraca-dependabot-location
19+
* Merge pull request [#324](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/324) from amirkaws/release-version-1.4.1
20+
* Merge pull request [#320](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/320) from aws-powertools/hjgraca-idempotency-example-fix
21+
* Merge pull request [#319](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/319) from aws-powertools/hjgraca-idempotency-example-DynamoDBv2-version
22+
* Merge pull request [#312](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/312) from hjgraca/metrics-prevent-exceed-100-datapoint
23+
* Merge pull request [#317](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/317) from aws-powertools/hjgraca-add-dependabot
24+
* Merge pull request [#300](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/300) from hossambarakat/feature/idempotency-example
25+
* Merge pull request [#298](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/298) from amirkaws/parameters-example
26+
* Merge pull request [#315](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/315) from aws-powertools/url-updates
27+
* Merge pull request [#314](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/314) from aws-powertools/readme-updates
28+
* Merge pull request [#313](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/313) from hjgraca/metrics-addmetric-raceconditiom
29+
* Merge pull request [#287](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/287) from swimming-potato/develop
30+
* Merge pull request [#303](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/303) from aws-powertools/remove-gh-pages
31+
* Merge pull request [#308](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/308) from aws-powertools/update-changelog-5332675096
32+
33+
1034
<a name="1.4.0"></a>
1135
## [1.4.0] - 2023-06-21
1236
## Bug Fixes
@@ -376,7 +400,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
376400
* Merge pull request [#1](https://github.com/aws-powertools/powertools-lambda-dotnet/issues/1) from sliedig/develop
377401

378402

379-
[Unreleased]: https://github.com/aws-powertools/powertools-lambda-dotnet/compare/1.4.0...HEAD
403+
[Unreleased]: https://github.com/aws-powertools/powertools-lambda-dotnet/compare/1.4.1...HEAD
404+
[1.4.1]: https://github.com/aws-powertools/powertools-lambda-dotnet/compare/1.4.0...1.4.1
380405
[1.4.0]: https://github.com/aws-powertools/powertools-lambda-dotnet/compare/1.3.0...1.4.0
381406
[1.3.0]: https://github.com/aws-powertools/powertools-lambda-dotnet/compare/1.2.0...1.3.0
382407
[1.2.0]: https://github.com/aws-powertools/powertools-lambda-dotnet/compare/1.1.0...1.2.0

examples/Idempotency/test/HelloWorld.Test/FunctionTest.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,11 @@
1414
*/
1515

1616
using System;
17-
using System.Collections.Generic;
18-
using System.Net;
19-
using System.Net.Http;
20-
using System.Text.Json;
21-
using System.Threading;
2217
using System.Threading.Tasks;
2318
using Amazon.DynamoDBv2;
24-
using Amazon.DynamoDBv2.DataModel;
25-
using Amazon.DynamoDBv2.Model;
2619
using Xunit;
2720
using Amazon.Lambda.APIGatewayEvents;
2821
using Amazon.Lambda.TestUtilities;
29-
using DotNet.Testcontainers.Builders;
30-
using DotNet.Testcontainers.Containers;
31-
using Moq;
32-
using Moq.Protected;
3322
using Xunit.Abstractions;
3423

3524
namespace HelloWorld.Tests

examples/Idempotency/test/HelloWorld.Test/HelloWorld.Tests.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
77
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
88
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.1" />
9-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
10-
<PackageReference Include="Moq" Version="4.18.4" />
11-
<PackageReference Include="xunit" Version="2.4.2" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
10+
<PackageReference Include="xunit" Version="2.5.0" />
1211
<PackageReference Include="Testcontainers" Version="3.3.0" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
12+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
1413
<PrivateAssets>all</PrivateAssets>
1514
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1615
</PackageReference>

examples/Logging/src/HelloWorld/HelloWorld.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
9-
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.5.0" />
9+
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.6.0" />
1010
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
11-
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.1.0" />
11+
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.1.1" />
1212
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.101.14" />
1313
</ItemGroup>
1414
</Project>

examples/Logging/test/HelloWorld.Test/FunctionTest.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
using Xunit;
2525
using Amazon.Lambda.APIGatewayEvents;
2626
using Amazon.Lambda.TestUtilities;
27-
using Moq;
28-
using Moq.Protected;
27+
using NSubstitute;
2928
using Xunit.Abstractions;
3029

3130
namespace HelloWorld.Tests
@@ -39,6 +38,20 @@ public FunctionTest(ITestOutputHelper testOutputHelper)
3938
_testOutputHelper = testOutputHelper;
4039
}
4140

41+
private class MockHttpMessageHandler : HttpMessageHandler
42+
{
43+
private readonly HttpResponseMessage _responseMessage;
44+
public MockHttpMessageHandler(HttpResponseMessage responseMessage)
45+
{
46+
_responseMessage = responseMessage;
47+
}
48+
49+
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
50+
{
51+
return await Task.FromResult(_responseMessage);
52+
}
53+
}
54+
4255
[Fact]
4356
public async Task TestHelloWorldFunctionHandler()
4457
{
@@ -47,21 +60,12 @@ public async Task TestHelloWorldFunctionHandler()
4760
var accountId = Guid.NewGuid().ToString("D");
4861
var location = "192.158. 1.38";
4962

50-
var dynamoDbContext = new Mock<IDynamoDBContext>();
51-
var handlerMock = new Mock<HttpMessageHandler>();
52-
handlerMock
53-
.Protected()
54-
.Setup<Task<HttpResponseMessage>>(
55-
"SendAsync",
56-
ItExpr.IsAny<HttpRequestMessage>(),
57-
ItExpr.IsAny<CancellationToken>()
58-
)
59-
.ReturnsAsync(new HttpResponseMessage
60-
{
61-
StatusCode = HttpStatusCode.OK,
62-
Content = new StringContent(location)
63-
})
64-
.Verifiable();
63+
var dynamoDbContext = Substitute.For<IDynamoDBContext>();
64+
var handlerMock = new MockHttpMessageHandler(new HttpResponseMessage
65+
{
66+
StatusCode = HttpStatusCode.OK,
67+
Content = new StringContent(location)
68+
});
6569

6670
var request = new APIGatewayProxyRequest
6771
{
@@ -94,7 +98,7 @@ public async Task TestHelloWorldFunctionHandler()
9498
Headers = new Dictionary<string, string> { { "Content-Type", "application/json" } }
9599
};
96100

97-
var function = new Function(dynamoDbContext.Object, new HttpClient(handlerMock.Object));
101+
var function = new Function(dynamoDbContext, new HttpClient(handlerMock));
98102
var response = await function.FunctionHandler(request, context);
99103

100104
_testOutputHelper.WriteLine("Lambda Response: \n" + response.Body);

examples/Logging/test/HelloWorld.Test/HelloWorld.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
88
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
99
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.101.14" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221221-03" />
11-
<PackageReference Include="Moq" Version="4.18.3" />
12-
<PackageReference Include="xunit" Version="2.4.2" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
11+
<PackageReference Include="NSubstitute" Version="5.0.0" />
12+
<PackageReference Include="xunit" Version="2.5.0" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>

examples/Metrics/src/HelloWorld/HelloWorld.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
9-
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.5.0" />
9+
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.6.0" />
1010
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
11-
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.1.0" />
12-
<PackageReference Include="AWS.Lambda.Powertools.Metrics" Version="1.2.0" />
11+
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.1.1" />
12+
<PackageReference Include="AWS.Lambda.Powertools.Metrics" Version="1.3.2" />
1313
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.101.14" />
1414
</ItemGroup>
1515
</Project>

examples/Metrics/test/HelloWorld.Test/FunctionTest.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
using Xunit;
2525
using Amazon.Lambda.APIGatewayEvents;
2626
using Amazon.Lambda.TestUtilities;
27-
using Moq;
28-
using Moq.Protected;
27+
using NSubstitute;
2928
using Xunit.Abstractions;
3029

3130
namespace HelloWorld.Tests
@@ -39,6 +38,20 @@ public FunctionTest(ITestOutputHelper testOutputHelper)
3938
_testOutputHelper = testOutputHelper;
4039
}
4140

41+
private class MockHttpMessageHandler : HttpMessageHandler
42+
{
43+
private readonly HttpResponseMessage _responseMessage;
44+
public MockHttpMessageHandler(HttpResponseMessage responseMessage)
45+
{
46+
_responseMessage = responseMessage;
47+
}
48+
49+
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
50+
{
51+
return await Task.FromResult(_responseMessage);
52+
}
53+
}
54+
4255
[Fact]
4356
public async Task TestHelloWorldFunctionHandler()
4457
{
@@ -47,21 +60,12 @@ public async Task TestHelloWorldFunctionHandler()
4760
var location = "192.158. 1.38";
4861
Environment.SetEnvironmentVariable("POWERTOOLS_METRICS_NAMESPACE","AWSLambdaPowertools");
4962

50-
var dynamoDbContext = new Mock<IDynamoDBContext>();
51-
var handlerMock = new Mock<HttpMessageHandler>();
52-
handlerMock
53-
.Protected()
54-
.Setup<Task<HttpResponseMessage>>(
55-
"SendAsync",
56-
ItExpr.IsAny<HttpRequestMessage>(),
57-
ItExpr.IsAny<CancellationToken>()
58-
)
59-
.ReturnsAsync(new HttpResponseMessage
60-
{
61-
StatusCode = HttpStatusCode.OK,
62-
Content = new StringContent(location)
63-
})
64-
.Verifiable();
63+
var dynamoDbContext = Substitute.For<IDynamoDBContext>();
64+
var handlerMock = new MockHttpMessageHandler(new HttpResponseMessage
65+
{
66+
StatusCode = HttpStatusCode.OK,
67+
Content = new StringContent(location)
68+
});
6569

6670
var request = new APIGatewayProxyRequest
6771
{
@@ -94,7 +98,7 @@ public async Task TestHelloWorldFunctionHandler()
9498
Headers = new Dictionary<string, string> { { "Content-Type", "application/json" } }
9599
};
96100

97-
var function = new Function(dynamoDbContext.Object, new HttpClient(handlerMock.Object));
101+
var function = new Function(dynamoDbContext, new HttpClient(handlerMock));
98102
var response = await function.FunctionHandler(request, context);
99103

100104
_testOutputHelper.WriteLine("Lambda Response: \n" + response.Body);

examples/Metrics/test/HelloWorld.Test/HelloWorld.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
88
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
99
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.101.14" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221221-03" />
11-
<PackageReference Include="Moq" Version="4.18.3" />
12-
<PackageReference Include="xunit" Version="2.4.2" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
11+
<PackageReference Include="NSubstitute" Version="5.0.0" />
12+
<PackageReference Include="xunit" Version="2.5.0" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
1414
<PrivateAssets>all</PrivateAssets>
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
</PackageReference>

examples/Parameters/src/HelloWorld/HelloWorld.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77
<ItemGroup>
88
<PackageReference Include="Amazon.Lambda.Core" Version="2.1.0" />
9-
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.5.0" />
9+
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.6.0" />
1010
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.3.0" />
1111
<PackageReference Include="AWS.Lambda.Powertools.Parameters" Version="0.0.2-preview" />
1212
</ItemGroup>

0 commit comments

Comments
 (0)