Commit 57c4249 1 parent 057cd6c commit 57c4249 Copy full SHA for 57c4249
File tree 5 files changed +55
-9
lines changed
src/WireMock.Net.Testcontainers
5 files changed +55
-9
lines changed Original file line number Diff line number Diff line change 29
29
<IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
30
30
</PackageReference >
31
31
<PackageReference Include =" Stef.Validation" Version =" 0.1.1" />
32
- <PackageReference Include =" Testcontainers" Version =" 3.6.0 " />
32
+ <PackageReference Include =" Testcontainers" Version =" [3.7.0] " />
33
33
<PackageReference Include =" JetBrains.Annotations" VersionOverride =" 2022.3.1" PrivateAssets =" All" Version =" 2023.3.0" />
34
34
</ItemGroup >
35
35
36
36
<ItemGroup >
37
37
<ProjectReference Include =" ..\WireMock.Net.RestClient\WireMock.Net.RestClient.csproj" />
38
38
</ItemGroup >
39
-
40
- <ItemGroup >
41
- <Folder Include =" Http\" />
42
- </ItemGroup >
39
+
43
40
</Project >
Original file line number Diff line number Diff line change @@ -16,10 +16,7 @@ public sealed class WireMockConfiguration : ContainerConfiguration
16
16
17
17
public bool HasBasicAuthentication => ! string . IsNullOrEmpty ( Username ) && ! string . IsNullOrEmpty ( Password ) ;
18
18
19
- public WireMockConfiguration (
20
- string ? username = null ,
21
- string ? password = null
22
- )
19
+ public WireMockConfiguration ( string ? username = null , string ? password = null )
23
20
{
24
21
Username = username ;
25
22
Password = password ;
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ public sealed class WireMockContainerBuilder : ContainerBuilder<WireMockContaine
25
25
26
26
private readonly Lazy < Task < bool > > _isWindowsAsLazy = new ( async ( ) =>
27
27
{
28
+ if ( TestcontainersSettings . OS . DockerEndpointAuthConfig == null )
29
+ {
30
+ throw new InvalidOperationException ( $ "The { nameof ( TestcontainersSettings . OS . DockerEndpointAuthConfig ) } is null. Check if Docker is started.") ;
31
+ }
32
+
28
33
using var dockerClientConfig = TestcontainersSettings . OS . DockerEndpointAuthConfig . GetDockerClientConfiguration ( ) ;
29
34
using var dockerClient = dockerClientConfig . CreateClient ( ) ;
30
35
Original file line number Diff line number Diff line change
1
+ #if NET6_0_OR_GREATER
2
+ using System . Threading . Tasks ;
3
+ using FluentAssertions ;
4
+ using FluentAssertions . Execution ;
5
+ using WireMock . Net . Testcontainers ;
6
+ using Xunit ;
7
+
8
+ namespace WireMock . Net . Tests . Testcontainers ;
9
+
10
+ public class TestcontainersTests
11
+ {
12
+ [ Fact ]
13
+ public async Task WireMockContainer_Build_and_StartAsync_and_StopAsync ( )
14
+ {
15
+ // Act
16
+ var wireMockContainer = new WireMockContainerBuilder ( )
17
+ . WithAutoRemove ( true )
18
+ . WithCleanUp ( true )
19
+ . Build ( ) ;
20
+
21
+ try
22
+ {
23
+ await wireMockContainer . StartAsync ( ) . ConfigureAwait ( false ) ;
24
+
25
+ // Assert
26
+ using ( new AssertionScope ( ) )
27
+ {
28
+ var url = wireMockContainer . GetPublicUrl ( ) ;
29
+ url . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
30
+
31
+ var adminClient = wireMockContainer . CreateWireMockAdminClient ( ) ;
32
+
33
+ var settings = await adminClient . GetSettingsAsync ( ) ;
34
+ settings . Should ( ) . NotBeNull ( ) ;
35
+ }
36
+ }
37
+ finally
38
+ {
39
+ await wireMockContainer . StopAsync ( ) ;
40
+ }
41
+ }
42
+ }
43
+ #endif
Original file line number Diff line number Diff line change 105
105
<PackageReference Include =" JsonConverter.System.Text.Json" Version =" 0.4.0" />
106
106
</ItemGroup >
107
107
108
+ <ItemGroup Condition =" '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'" >
109
+ <ProjectReference Include =" ..\..\src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj" />
110
+ </ItemGroup >
111
+
108
112
<ItemGroup >
109
113
<None Update =" OpenApiParser\*.json" >
110
114
<CopyToOutputDirectory >PreserveNewest</CopyToOutputDirectory >
You can’t perform that action at this time.
0 commit comments