File tree Expand file tree Collapse file tree 5 files changed +26
-5
lines changed
SWEN3.Paperless.RabbitMq.Tests Expand file tree Collapse file tree 5 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 1+ using DotNet . Testcontainers . Builders ;
2+ using DotNet . Testcontainers . Containers ;
3+
4+ namespace SWEN3 . Paperless . RabbitMq . Tests . Helpers ;
5+
6+ internal static class RabbitMqTestContainerFactory
7+ {
8+ public static RabbitMqContainer Create ( ) =>
9+ new RabbitMqBuilder ( )
10+ . WithImage ( "rabbitmq:3.12-management" )
11+ . WithEnvironment ( "RABBITMQ_LOGS" , "-" )
12+ . WithEnvironment ( "RABBITMQ_SASL_LOGS" , "-" )
13+ . WithTmpfsMount ( "/var/log/rabbitmq" )
14+ . WithWaitStrategy ( Wait . ForUnixContainer ( )
15+ . UntilMessageIsLogged ( "Server startup complete" ) )
16+ . Build ( ) ;
17+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace SWEN3.Paperless.RabbitMq.Tests.Integration;
22
33public class GenAIIntegrationTests : IAsyncLifetime
44{
5- private readonly RabbitMqContainer _container = new RabbitMqBuilder ( ) . Build ( ) ;
5+ private readonly RabbitMqContainer _container = RabbitMqTestContainerFactory . Create ( ) ;
66 private IHost _host = null ! ;
77 private IServiceProvider _serviceProvider = null ! ;
88
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace SWEN3.Paperless.RabbitMq.Tests.Integration;
22
33public class RabbitMqConsumerIntegrationTests : IAsyncLifetime
44{
5- private readonly RabbitMqContainer _container = new RabbitMqBuilder ( ) . Build ( ) ;
5+ private readonly RabbitMqContainer _container = RabbitMqTestContainerFactory . Create ( ) ;
66 private IServiceProvider _serviceProvider = null ! ;
77
88 public async ValueTask InitializeAsync ( )
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ namespace SWEN3.Paperless.RabbitMq.Tests.Integration;
22
33public class RabbitMqExtensionsTests : IAsyncLifetime
44{
5- private readonly RabbitMqContainer _container = new RabbitMqBuilder ( ) . Build ( ) ;
5+ private readonly RabbitMqContainer _container = RabbitMqTestContainerFactory . Create ( ) ;
66 private IConfiguration _configuration = null ! ;
77
88 public async ValueTask InitializeAsync ( )
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFramework >net8.0</ TargetFramework >
4+ <TargetFrameworks >net8.0;net9.0</ TargetFrameworks >
55 <ImplicitUsings >enable</ImplicitUsings >
66 <Nullable >enable</Nullable >
77 <LangVersion >latestMajor</LangVersion >
2626 <PackageReference Include =" xunit.v3" Version =" 3.2.0" />
2727 </ItemGroup >
2828
29- <ItemGroup >
29+ <ItemGroup Condition = " '$(TargetFramework)' == 'net8.0' " >
3030 <PackageReference Include =" Microsoft.AspNetCore.Mvc.Testing" Version =" 8.0.10" />
31+ <Compile Remove =" Integration\**\*.cs" />
3132 </ItemGroup >
3233
34+ <ItemGroup Condition =" '$(TargetFramework)' == 'net9.0'" >
35+ <PackageReference Include =" Microsoft.AspNetCore.Mvc.Testing" Version =" 9.0.0" />
36+ </ItemGroup >
3337 <ItemGroup >
3438 <ProjectReference Include =" ..\SWEN3.Paperless.RabbitMq\SWEN3.Paperless.RabbitMq.csproj" />
3539 </ItemGroup >
You can’t perform that action at this time.
0 commit comments