File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828 restore-keys : |
2929 ${{ runner.os }}-nuget
3030 - name : Install dependencies
31- run : cd other_langs/tests_dotnet && dotnet restore ExampleTestProject/ && dotnet restore ebs
31+ run : cd other_langs/tests_dotnet && dotnet restore s3 && dotnet restore sqs
3232 - name : Run tests
3333 run : |
3434 mkdir ~/.aws && touch ~/.aws/credentials && echo -e "[default]\naws_access_key_id = test\naws_secret_access_key = test" > ~/.aws/credentials
35- cd other_langs/tests_dotnet && dotnet test ExampleTestProject/ && dotnet restore ebs
35+ cd other_langs/tests_dotnet
36+ dotnet test s3 -v n
37+ dotnet test sqs -v n
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFramework >net7 .0</TargetFramework >
4+ <TargetFramework >net8 .0</TargetFramework >
55 <ImplicitUsings >enable</ImplicitUsings >
66 <Nullable >enable</Nullable >
77
Original file line number Diff line number Diff line change 1+ using FluentAssertions ;
2+ using System . Net ;
3+
4+ // To interact with Amazon S3.
5+ using Amazon . SQS ;
6+ using Amazon . SQS . Model ;
7+
8+ public class UnitTest1
9+ {
10+
11+ [ Fact ]
12+ public async Task TestCreateQueue ( )
13+ {
14+
15+ // Create an SQS client connected to the local moto server
16+ var sqsClient = new AmazonSQSClient (
17+ new AmazonSQSConfig
18+ {
19+ // Use the local Moto server URL
20+ ServiceURL = "http://127.0.0.1:5000" ,
21+
22+ } ) ;
23+
24+ // Create the queue and get the response
25+ var createQueueResponse = await CreateQueueAsync ( sqsClient ) ;
26+ createQueueResponse . QueueUrl . Should ( ) . Be ( "http://127.0.0.1:5000/123456789012/MyQueue" ) ;
27+ }
28+
29+ private static async Task < CreateQueueResponse > CreateQueueAsync ( AmazonSQSClient sqsClient )
30+ {
31+ var createQueueRequest = new CreateQueueRequest
32+ {
33+ QueueName = "MyQueue"
34+ } ;
35+
36+ return await sqsClient . CreateQueueAsync ( createQueueRequest ) ;
37+ }
38+
39+ }
Original file line number Diff line number Diff line change 1+ global using Xunit ;
Original file line number Diff line number Diff line change 1+ <Project Sdk =" Microsoft.NET.Sdk" >
2+
3+ <PropertyGroup >
4+ <TargetFramework >net8.0</TargetFramework >
5+ <ImplicitUsings >enable</ImplicitUsings >
6+ <Nullable >enable</Nullable >
7+
8+ <IsPackable >true</IsPackable >
9+ <PackAsTool >true</PackAsTool >
10+
11+ <UserSecretsId >45a910a7-aba2-43ee-ad3c-ccad57f044d9</UserSecretsId >
12+ </PropertyGroup >
13+
14+ <ItemGroup >
15+ <PackageReference Include =" AWSSDK.SQS" Version =" 3.7.200" />
16+ <PackageReference Include =" FluentAssertions" Version =" 6.8.0" />
17+ <PackageReference Include =" Microsoft.Extensions.Configuration.UserSecrets" Version =" 7.0.0" />
18+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.1.0" />
19+ <PackageReference Include =" xunit" Version =" 2.4.1" />
20+ <PackageReference Include =" xunit.runner.visualstudio" Version =" 2.4.3" >
21+ <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
22+ <PrivateAssets >all</PrivateAssets >
23+ </PackageReference >
24+ </ItemGroup >
25+
26+ </Project >
You can’t perform that action at this time.
0 commit comments