-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Admin: Add DotNet tests for SQS (#8323)
- Loading branch information
Showing
7 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...mpleTestProject/ExampleTestProject.csproj → other_langs/tests_dotnet/s3/s3.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using FluentAssertions; | ||
using System.Net; | ||
|
||
// To interact with Amazon S3. | ||
using Amazon.SQS; | ||
using Amazon.SQS.Model; | ||
|
||
public class UnitTest1 | ||
{ | ||
|
||
[Fact] | ||
public async Task TestCreateQueue() | ||
{ | ||
|
||
// Create an SQS client connected to the local moto server | ||
var sqsClient = new AmazonSQSClient( | ||
new AmazonSQSConfig | ||
{ | ||
// Use the local Moto server URL | ||
ServiceURL = "http://127.0.0.1:5000", | ||
|
||
}); | ||
|
||
// Create the queue and get the response | ||
var createQueueResponse = await CreateQueueAsync(sqsClient); | ||
createQueueResponse.QueueUrl.Should().Be("http://127.0.0.1:5000/123456789012/MyQueue"); | ||
} | ||
|
||
private static async Task<CreateQueueResponse> CreateQueueAsync(AmazonSQSClient sqsClient) | ||
{ | ||
var createQueueRequest = new CreateQueueRequest | ||
{ | ||
QueueName = "MyQueue" | ||
}; | ||
|
||
return await sqsClient.CreateQueueAsync(createQueueRequest); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using Xunit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>true</IsPackable> | ||
<PackAsTool>true</PackAsTool> | ||
|
||
<UserSecretsId>45a910a7-aba2-43ee-ad3c-ccad57f044d9</UserSecretsId> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AWSSDK.SQS" Version="3.7.200" /> | ||
<PackageReference Include="FluentAssertions" Version="6.8.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
</Project> |