mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-21 00:11:44 +02:00
mm + ...
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
# 1.12.0 (30 August 2025)
|
||||||
|
- [#1357](https://github.com/wiremock/WireMock.Net/pull/1357) - Upgrade Testcontainers to 4.7.0 [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#1356](https://github.com/wiremock/WireMock.Net/issues/1356) - WireMock.Net 1.11.2 is not compatible with TestContainers 4.7.0 [bug]
|
||||||
|
|
||||||
# 1.11.2 (27 August 2025)
|
# 1.11.2 (27 August 2025)
|
||||||
- [#1352](https://github.com/wiremock/WireMock.Net/pull/1352) - Add additional try-catch to TypeLoader logic [feature] contributed by [StefH](https://github.com/StefH)
|
- [#1352](https://github.com/wiremock/WireMock.Net/pull/1352) - Add additional try-catch to TypeLoader logic [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#1354](https://github.com/wiremock/WireMock.Net/pull/1354) - Add System.Net.Http again to solve CVE warning [bug] contributed by [StefH](https://github.com/StefH)
|
- [#1354](https://github.com/wiremock/WireMock.Net/pull/1354) - Add System.Net.Http again to solve CVE warning [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
rem https://github.com/StefH/GitHubReleaseNotes
|
rem https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
SET version=1.11.2
|
SET version=1.12.0
|
||||||
|
|
||||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels wontfix test question invalid doc duplicate example environment --version %version% --token %GH_TOKEN%
|
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels wontfix test question invalid doc duplicate example environment --version %version% --token %GH_TOKEN%
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
# 1.11.2 (27 August 2025)
|
# 1.12.0 (30 August 2025)
|
||||||
- #1352 Add additional try-catch to TypeLoader logic [feature]
|
- #1357 Upgrade Testcontainers to 4.7.0 [feature]
|
||||||
- #1354 Add System.Net.Http again to solve CVE warning [bug]
|
- #1356 WireMock.Net 1.11.2 is not compatible with TestContainers 4.7.0 [bug]
|
||||||
- #1355 Revert JetBrains.Annotations and add System.Text.RegularExpressions t… [bug]
|
|
||||||
- #1071 Split WireMock into multiple nuget packages depending on features [feature]
|
|
||||||
- #1351 Version 1.11.0 seems to have a dependency to non-existing version of JetBrans.Annotations [bug]
|
|
||||||
- #1353 1.11.0: NU1903: Warning As Error: Package 'System.Net.Http' 4.3.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-7jgj-8wvc-jh57 [bug]
|
|
||||||
|
|
||||||
The full release notes can be found here: https://github.com/wiremock/WireMock.Net/blob/master/CHANGELOG.md
|
The full release notes can be found here: https://github.com/wiremock/WireMock.Net/blob/master/CHANGELOG.md
|
||||||
@@ -68,14 +68,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Org.RestClient", "
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Org.Abstractions", "src\WireMock.Org.Abstractions\WireMock.Org.Abstractions.csproj", "{3BA5109E-5F30-4CC2-B699-02EC82560AA6}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Org.Abstractions", "src\WireMock.Org.Abstractions\WireMock.Org.Abstractions.csproj", "{3BA5109E-5F30-4CC2-B699-02EC82560AA6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.WebApplication.NET6", "examples\WireMock.Net.WebApplication.NET6\WireMock.Net.WebApplication.NET6.csproj", "{3F7AA023-6833-4856-A08A-4B5717B592B8}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.Proxy.NETCoreApp", "examples\WireMock.Net.Console.Proxy.NETCoreApp\WireMock.Net.Console.Proxy.NETCoreApp.csproj", "{670C7562-C154-442E-A249-7D26849BCD13}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.Proxy.NETCoreApp", "examples\WireMock.Net.Console.Proxy.NETCoreApp\WireMock.Net.Console.Proxy.NETCoreApp.csproj", "{670C7562-C154-442E-A249-7D26849BCD13}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.xUnit", "src\WireMock.Net.xUnit\WireMock.Net.xUnit.csproj", "{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.xUnit", "src\WireMock.Net.xUnit\WireMock.Net.xUnit.csproj", "{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NET6.WithCertificate", "examples\WireMock.Net.Console.NET6.WithCertificate\WireMock.Net.Console.NET6.WithCertificate.csproj", "{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueExample", "examples\WireMockAzureQueueExample\WireMockAzureQueueExample.csproj", "{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueExample", "examples\WireMockAzureQueueExample\WireMockAzureQueueExample.csproj", "{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Testcontainers", "src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj", "{12B016A5-9D8B-4EFE-96C2-CA51BE43367D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Testcontainers", "src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj", "{12B016A5-9D8B-4EFE-96C2-CA51BE43367D}"
|
||||||
@@ -144,6 +140,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Extensions.Rou
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.ProtoBuf", "src\WireMock.Net.ProtoBuf\WireMock.Net.ProtoBuf.csproj", "{B47413AA-55D3-49A7-896A-17ADBFF72407}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.ProtoBuf", "src\WireMock.Net.ProtoBuf\WireMock.Net.ProtoBuf.csproj", "{B47413AA-55D3-49A7-896A-17ADBFF72407}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.NET8.WithCertificate", "examples\WireMock.Net.Console.NET8.WithCertificate\WireMock.Net.Console.NET8.WithCertificate.csproj", "{2D86546D-8A24-0A55-C962-2071BD299E05}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.WebApplication.IIS", "examples\WireMock.Net.WebApplication.IIS\WireMock.Net.WebApplication.IIS.csproj", "{5E6E9FA7-9135-7B82-2CCD-8CA87AC8043C}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -206,10 +206,6 @@ Global
|
|||||||
{3BA5109E-5F30-4CC2-B699-02EC82560AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{3BA5109E-5F30-4CC2-B699-02EC82560AA6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3BA5109E-5F30-4CC2-B699-02EC82560AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{3BA5109E-5F30-4CC2-B699-02EC82560AA6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{3BA5109E-5F30-4CC2-B699-02EC82560AA6}.Release|Any CPU.Build.0 = Release|Any CPU
|
{3BA5109E-5F30-4CC2-B699-02EC82560AA6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{3F7AA023-6833-4856-A08A-4B5717B592B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{3F7AA023-6833-4856-A08A-4B5717B592B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{3F7AA023-6833-4856-A08A-4B5717B592B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{3F7AA023-6833-4856-A08A-4B5717B592B8}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{670C7562-C154-442E-A249-7D26849BCD13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{670C7562-C154-442E-A249-7D26849BCD13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{670C7562-C154-442E-A249-7D26849BCD13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{670C7562-C154-442E-A249-7D26849BCD13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{670C7562-C154-442E-A249-7D26849BCD13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{670C7562-C154-442E-A249-7D26849BCD13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -218,10 +214,6 @@ Global
|
|||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -350,6 +342,14 @@ Global
|
|||||||
{B47413AA-55D3-49A7-896A-17ADBFF72407}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{B47413AA-55D3-49A7-896A-17ADBFF72407}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{B47413AA-55D3-49A7-896A-17ADBFF72407}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{B47413AA-55D3-49A7-896A-17ADBFF72407}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{B47413AA-55D3-49A7-896A-17ADBFF72407}.Release|Any CPU.Build.0 = Release|Any CPU
|
{B47413AA-55D3-49A7-896A-17ADBFF72407}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2D86546D-8A24-0A55-C962-2071BD299E05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2D86546D-8A24-0A55-C962-2071BD299E05}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2D86546D-8A24-0A55-C962-2071BD299E05}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2D86546D-8A24-0A55-C962-2071BD299E05}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5E6E9FA7-9135-7B82-2CCD-8CA87AC8043C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5E6E9FA7-9135-7B82-2CCD-8CA87AC8043C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5E6E9FA7-9135-7B82-2CCD-8CA87AC8043C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5E6E9FA7-9135-7B82-2CCD-8CA87AC8043C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -371,10 +371,8 @@ Global
|
|||||||
{5B64F6CA-BF6B-4F67-BB2A-9C47E441703E} = {7EFB2C5B-1BB2-4AAF-BC9F-216ED80C594D}
|
{5B64F6CA-BF6B-4F67-BB2A-9C47E441703E} = {7EFB2C5B-1BB2-4AAF-BC9F-216ED80C594D}
|
||||||
{08B29DB1-FEFE-408A-AD0A-6BA6DDC8D70F} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{08B29DB1-FEFE-408A-AD0A-6BA6DDC8D70F} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
{3BA5109E-5F30-4CC2-B699-02EC82560AA6} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{3BA5109E-5F30-4CC2-B699-02EC82560AA6} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
{3F7AA023-6833-4856-A08A-4B5717B592B8} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
|
||||||
{670C7562-C154-442E-A249-7D26849BCD13} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
{670C7562-C154-442E-A249-7D26849BCD13} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
|
||||||
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
{12B016A5-9D8B-4EFE-96C2-CA51BE43367D} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{12B016A5-9D8B-4EFE-96C2-CA51BE43367D} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
{56A38798-C48B-4A4A-B805-071E05C02CE1} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
{56A38798-C48B-4A4A-B805-071E05C02CE1} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
@@ -407,6 +405,8 @@ Global
|
|||||||
{3FCBCA9C-9DB0-4A96-B47E-30470764CC9C} = {0BB8B634-407A-4610-A91F-11586990767A}
|
{3FCBCA9C-9DB0-4A96-B47E-30470764CC9C} = {0BB8B634-407A-4610-A91F-11586990767A}
|
||||||
{1E874C8F-08A2-493B-8421-619F9A6E9E77} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{1E874C8F-08A2-493B-8421-619F9A6E9E77} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
{B47413AA-55D3-49A7-896A-17ADBFF72407} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{B47413AA-55D3-49A7-896A-17ADBFF72407} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
|
{2D86546D-8A24-0A55-C962-2071BD299E05} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
|
{5E6E9FA7-9135-7B82-2CCD-8CA87AC8043C} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458}
|
SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -1,34 +1,34 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<DefineConstants>$(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF</DefineConstants>
|
<!--<DefineConstants>$(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF</DefineConstants>-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="__admin\mappings\*.json">
|
<Content Include="__admin\mappings\*.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="__admin\mappings\1.cs" />
|
<Compile Remove="__admin\mappings\1.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
<PackageReference Include="log4net" Version="2.0.15" />
|
<PackageReference Include="log4net" Version="2.0.15" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="log4net.config">
|
<None Update="log4net.config">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="nlog.config">
|
<None Update="nlog.config">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ApplicationIcon>../../resources/WireMock.Net-Logo.ico</ApplicationIcon>
|
<ApplicationIcon>../../resources/WireMock.Net-Logo.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -7,16 +7,16 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<!--<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>-->
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.12.0.118525" />
|
<PackageReference Update="SonarAnalyzer.CSharp" Version="10.12.0.118525" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="WireMock.Net" Version="1.8.11" />
|
<PackageReference Include="WireMock.Net" Version="1.12.0" />
|
||||||
</ItemGroup>-->
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -115,10 +115,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="log4net">
|
<PackageReference Include="log4net">
|
||||||
<Version>3.0.3</Version>
|
<Version>3.2.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="WireMock.Net">
|
<PackageReference Include="WireMock.Net">
|
||||||
<Version>1.8.11</Version>
|
<Version>1.12.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<!--<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>-->
|
<!--<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>-->
|
||||||
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
|
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
|
||||||
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
|
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
|
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
|
||||||
<UserSecretsId>bb7d8355-68c4-4f81-8c2d-6cdd80cd7602</UserSecretsId>
|
<UserSecretsId>bb7d8355-68c4-4f81-8c2d-6cdd80cd7602</UserSecretsId>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.1" />
|
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.1" />
|
||||||
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.12.1" />
|
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.12.1" />
|
||||||
<PackageReference Include="Azure.Storage.Queues" Version="12.12.0" />
|
<PackageReference Include="Azure.Storage.Queues" Version="12.12.0" />
|
||||||
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.5" />
|
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.5" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
|
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="host.json">
|
<None Update="host.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="local.settings.json">
|
<None Update="local.settings.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -47,5 +47,5 @@ public class LogRequestMatchModel
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// The match details.
|
/// The match details.
|
||||||
/// </value>
|
/// </value>
|
||||||
public IList<object> MatchDetails { get; set; }
|
public IList<object> MatchDetails { get; set; } = [];
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AwesomeAssertions" Version="9.0.0" />
|
<PackageReference Include="AwesomeAssertions" Version="9.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.7.0" />
|
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.7.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -33,16 +32,25 @@ internal class MimeKitUtils : IMimeKitUtils
|
|||||||
StartsWithMultiPart(contentTypeHeader)
|
StartsWithMultiPart(contentTypeHeader)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var bytes = requestMessage.BodyData?.DetectedBodyType switch
|
byte[] bytes;
|
||||||
|
|
||||||
|
switch (requestMessage.BodyData?.DetectedBodyType)
|
||||||
{
|
{
|
||||||
// If the body is bytes, use the BodyAsBytes to match on.
|
// If the body is bytes, use the BodyAsBytes to match on.
|
||||||
BodyType.Bytes => requestMessage.BodyData.BodyAsBytes!,
|
case BodyType.Bytes:
|
||||||
|
bytes = requestMessage.BodyData.BodyAsBytes!;
|
||||||
|
break;
|
||||||
|
|
||||||
// If the body is a String or MultiPart, use the BodyAsString to match on.
|
// If the body is a String or MultiPart, use the BodyAsString to match on.
|
||||||
BodyType.String or BodyType.MultiPart => Encoding.UTF8.GetBytes(requestMessage.BodyData.BodyAsString!),
|
case BodyType.String or BodyType.MultiPart:
|
||||||
|
bytes = Encoding.UTF8.GetBytes(requestMessage.BodyData.BodyAsString!);
|
||||||
|
break;
|
||||||
|
|
||||||
_ => throw new NotSupportedException()
|
// Else return false.
|
||||||
};
|
default:
|
||||||
|
mimeMessageData = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var fixedBytes = FixBytes(bytes, contentTypeHeader[0]);
|
var fixedBytes = FixBytes(bytes, contentTypeHeader[0]);
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace WireMock.Matchers.Request;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RequestMessageMultiPartMatcher : IRequestMatcher
|
public class RequestMessageMultiPartMatcher : IRequestMatcher
|
||||||
{
|
{
|
||||||
private static readonly IMimeKitUtils MimeKitUtils = TypeLoader.LoadStaticInstance<IMimeKitUtils>();
|
private readonly IMimeKitUtils _mimeKitUtils = LoadMimeKitUtils();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The matchers.
|
/// The matchers.
|
||||||
@@ -62,7 +62,7 @@ public class RequestMessageMultiPartMatcher : IRequestMatcher
|
|||||||
return requestMatchResult.AddScore(GetType(), score, null);
|
return requestMatchResult.AddScore(GetType(), score, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MimeKitUtils.TryGetMimeMessage(requestMessage, out var message))
|
if (!_mimeKitUtils.TryGetMimeMessage(requestMessage, out var message))
|
||||||
{
|
{
|
||||||
return requestMatchResult.AddScore(GetType(), score, null);
|
return requestMatchResult.AddScore(GetType(), score, null);
|
||||||
}
|
}
|
||||||
@@ -96,4 +96,14 @@ public class RequestMessageMultiPartMatcher : IRequestMatcher
|
|||||||
|
|
||||||
return requestMatchResult.AddScore(GetType(), score, exception);
|
return requestMatchResult.AddScore(GetType(), score, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IMimeKitUtils LoadMimeKitUtils()
|
||||||
|
{
|
||||||
|
if (TypeLoader.TryLoadStaticInstance<IMimeKitUtils>(out var mimeKitUtils))
|
||||||
|
{
|
||||||
|
return mimeKitUtils;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException("MimeKit is required for RequestMessageMultiPartMatcher. Please install the WireMock.Net.MimePart package.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -179,9 +179,12 @@ namespace WireMock.Owin.Mappers
|
|||||||
return (bodyData.Encoding ?? _utf8NoBom).GetBytes(jsonBody);
|
return (bodyData.Encoding ?? _utf8NoBom).GetBytes(jsonBody);
|
||||||
|
|
||||||
case BodyType.ProtoBuf:
|
case BodyType.ProtoBuf:
|
||||||
var protoDefinitions = bodyData.ProtoDefinition?.Invoke().Texts;
|
if (TypeLoader.TryLoadStaticInstance<IProtoBufUtils>(out var protoBufUtils))
|
||||||
var protoBufUtils = TypeLoader.LoadStaticInstance<IProtoBufUtils>();
|
{
|
||||||
return await protoBufUtils.GetProtoBufMessageWithHeaderAsync(protoDefinitions, bodyData.ProtoBufMessageType, bodyData.BodyAsJson).ConfigureAwait(false);
|
var protoDefinitions = bodyData.ProtoDefinition?.Invoke().Texts;
|
||||||
|
return await protoBufUtils.GetProtoBufMessageWithHeaderAsync(protoDefinitions, bodyData.ProtoBufMessageType, bodyData.BodyAsJson).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case BodyType.Bytes:
|
case BodyType.Bytes:
|
||||||
return bodyData.BodyAsBytes;
|
return bodyData.BodyAsBytes;
|
||||||
|
|||||||
@@ -184,16 +184,9 @@ public class RequestMessage : IRequestMessage
|
|||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#if MIMEKIT
|
#if MIMEKIT
|
||||||
try
|
if (TypeLoader.TryLoadStaticInstance<IMimeKitUtils>(out var mimeKitUtils) && mimeKitUtils.TryGetMimeMessage(this, out var mimeMessage))
|
||||||
{
|
{
|
||||||
if (TypeLoader.LoadStaticInstance<IMimeKitUtils>().TryGetMimeMessage(this, out var mimeMessage))
|
BodyAsMimeMessage = mimeMessage;
|
||||||
{
|
|
||||||
BodyAsMimeMessage = mimeMessage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// Ignore exception from MimeMessage.Load
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,12 @@ internal class MatcherMapper
|
|||||||
case "CSharpCodeMatcher":
|
case "CSharpCodeMatcher":
|
||||||
if (_settings.AllowCSharpCodeMatcher == true)
|
if (_settings.AllowCSharpCodeMatcher == true)
|
||||||
{
|
{
|
||||||
return TypeLoader.LoadNewInstance<ICSharpCodeMatcher>(matchBehaviour, matchOperator, stringPatterns);
|
if (TypeLoader.TryLoadNewInstance<ICSharpCodeMatcher>(out var csharpCodeMatcher, matchBehaviour, matchOperator, stringPatterns))
|
||||||
|
{
|
||||||
|
return csharpCodeMatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException("The 'CSharpCodeMatcher' cannot be loaded. Please install the WireMock.Net.Matchers.CSharpCode package.");
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NotSupportedException("It's not allowed to use the 'CSharpCodeMatcher' because WireMockServerSettings.AllowCSharpCodeMatcher is not set to 'true'.");
|
throw new NotSupportedException("It's not allowed to use the 'CSharpCodeMatcher' because WireMockServerSettings.AllowCSharpCodeMatcher is not set to 'true'.");
|
||||||
@@ -75,7 +80,12 @@ internal class MatcherMapper
|
|||||||
case "GraphQLMatcher":
|
case "GraphQLMatcher":
|
||||||
var patternAsString = stringPatterns[0].GetPattern();
|
var patternAsString = stringPatterns[0].GetPattern();
|
||||||
var schema = new AnyOf<string, StringPattern, ISchemaData>(patternAsString);
|
var schema = new AnyOf<string, StringPattern, ISchemaData>(patternAsString);
|
||||||
return TypeLoader.LoadNewInstance<IGraphQLMatcher>(schema, matcherModel.CustomScalars, matchBehaviour, matchOperator);
|
if (TypeLoader.TryLoadNewInstance<IGraphQLMatcher>(out var graphQLMatcher, schema, matcherModel.CustomScalars, matchBehaviour, matchOperator))
|
||||||
|
{
|
||||||
|
return graphQLMatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException("The 'GraphQLMatcher' cannot be loaded. Please install the WireMock.Net.GraphQL package.");
|
||||||
|
|
||||||
case "MimePartMatcher":
|
case "MimePartMatcher":
|
||||||
return CreateMimePartMatcher(matchBehaviour, matcherModel);
|
return CreateMimePartMatcher(matchBehaviour, matcherModel);
|
||||||
@@ -282,18 +292,34 @@ internal class MatcherMapper
|
|||||||
var contentTransferEncodingMatcher = Map(matcher.ContentTransferEncodingMatcher) as IStringMatcher;
|
var contentTransferEncodingMatcher = Map(matcher.ContentTransferEncodingMatcher) as IStringMatcher;
|
||||||
var contentMatcher = Map(matcher.ContentMatcher);
|
var contentMatcher = Map(matcher.ContentMatcher);
|
||||||
|
|
||||||
return TypeLoader.LoadNewInstance<IMimePartMatcher>(matchBehaviour, contentTypeMatcher, contentDispositionMatcher, contentTransferEncodingMatcher, contentMatcher);
|
if (TypeLoader.TryLoadNewInstance<IMimePartMatcher>(
|
||||||
|
out var mimePartMatcher,
|
||||||
|
matchBehaviour,
|
||||||
|
contentTypeMatcher,
|
||||||
|
contentDispositionMatcher,
|
||||||
|
contentTransferEncodingMatcher,
|
||||||
|
contentMatcher))
|
||||||
|
{
|
||||||
|
return mimePartMatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException("The 'MimePartMatcher' cannot be loaded. Please install the WireMock.Net.MimePart package.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private IProtoBufMatcher CreateProtoBufMatcher(MatchBehaviour? matchBehaviour, IReadOnlyList<string> protoDefinitions, MatcherModel matcher)
|
private IProtoBufMatcher CreateProtoBufMatcher(MatchBehaviour? matchBehaviour, IReadOnlyList<string> protoDefinitions, MatcherModel matcher)
|
||||||
{
|
{
|
||||||
var objectMatcher = Map(matcher.ContentMatcher) as IObjectMatcher;
|
var objectMatcher = Map(matcher.ContentMatcher) as IObjectMatcher;
|
||||||
|
|
||||||
return TypeLoader.LoadNewInstance<IProtoBufMatcher>(
|
if (TypeLoader.TryLoadNewInstance<IProtoBufMatcher>(
|
||||||
|
out var protobufMatcher,
|
||||||
() => ProtoDefinitionUtils.GetIdOrTexts(_settings, protoDefinitions.ToArray()),
|
() => ProtoDefinitionUtils.GetIdOrTexts(_settings, protoDefinitions.ToArray()),
|
||||||
matcher.ProtoBufMessageType!,
|
matcher.ProtoBufMessageType!,
|
||||||
matchBehaviour ?? MatchBehaviour.AcceptOnMatch,
|
matchBehaviour ?? MatchBehaviour.AcceptOnMatch,
|
||||||
objectMatcher
|
objectMatcher))
|
||||||
);
|
{
|
||||||
|
return protobufMatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new InvalidOperationException("The 'ProtoBufMatcher' cannot be loaded. Please install the WireMock.Net.ProtoBuf package.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,10 +366,8 @@ public partial class WireMockServer
|
|||||||
}
|
}
|
||||||
else if (responseModel.BodyAsJson != null)
|
else if (responseModel.BodyAsJson != null)
|
||||||
{
|
{
|
||||||
if (responseModel.ProtoBufMessageType != null)
|
if (responseModel.ProtoBufMessageType != null && TypeLoader.TryLoadStaticInstance<IProtoBufUtils>(out var protoBufUtils))
|
||||||
{
|
{
|
||||||
var protoBufUtils = TypeLoader.LoadStaticInstance<IProtoBufUtils>();
|
|
||||||
|
|
||||||
if (responseModel.ProtoDefinition != null)
|
if (responseModel.ProtoDefinition != null)
|
||||||
{
|
{
|
||||||
responseBuilder = protoBufUtils.UpdateResponseBuilder(responseBuilder, responseModel.ProtoBufMessageType, responseModel.BodyAsJson, responseModel.ProtoDefinition);
|
responseBuilder = protoBufUtils.UpdateResponseBuilder(responseBuilder, responseModel.ProtoBufMessageType, responseModel.BodyAsJson, responseModel.ProtoDefinition);
|
||||||
|
|||||||
@@ -100,7 +100,10 @@ public class RequestMessageGraphQLMatcher : IRequestMatcher
|
|||||||
IDictionary<string, Type>? customScalars
|
IDictionary<string, Type>? customScalars
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var graphQLMatcher = TypeLoader.LoadNewInstance<IGraphQLMatcher>(schema, customScalars, matchBehaviour, MatchOperator.Or);
|
if (TypeLoader.TryLoadNewInstance<IGraphQLMatcher>(out var graphQLMatcher, schema, customScalars, matchBehaviour, MatchOperator.Or))
|
||||||
return [graphQLMatcher];
|
{
|
||||||
|
return [graphQLMatcher];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,10 @@ public class RequestMessageProtoBufMatcher : IRequestMatcher
|
|||||||
/// <param name="matcher">The optional matcher to use to match the ProtoBuf as (json) object.</param>
|
/// <param name="matcher">The optional matcher to use to match the ProtoBuf as (json) object.</param>
|
||||||
public RequestMessageProtoBufMatcher(MatchBehaviour matchBehaviour, Func<IdOrTexts> protoDefinition, string messageType, IObjectMatcher? matcher = null)
|
public RequestMessageProtoBufMatcher(MatchBehaviour matchBehaviour, Func<IdOrTexts> protoDefinition, string messageType, IObjectMatcher? matcher = null)
|
||||||
{
|
{
|
||||||
Matcher = TypeLoader.LoadNewInstance<IProtoBufMatcher>(protoDefinition, messageType, matchBehaviour, matcher);
|
if (TypeLoader.TryLoadNewInstance<IProtoBufMatcher>(out var protoBufMatcher, protoDefinition, messageType, matchBehaviour, matcher))
|
||||||
|
{
|
||||||
|
Matcher = protoBufMatcher;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -14,68 +14,130 @@ internal static class TypeLoader
|
|||||||
{
|
{
|
||||||
private static readonly ConcurrentDictionary<string, Type> Assemblies = new();
|
private static readonly ConcurrentDictionary<string, Type> Assemblies = new();
|
||||||
private static readonly ConcurrentDictionary<Type, object> Instances = new();
|
private static readonly ConcurrentDictionary<Type, object> Instances = new();
|
||||||
|
private static readonly ConcurrentBag<(string FullName, Type Type)> InstancesWhichCannotBeFoundByFullName = [];
|
||||||
|
private static readonly ConcurrentBag<(string FullName, Type Type)> StaticInstancesWhichCannotBeFoundByFullName = [];
|
||||||
|
private static readonly ConcurrentBag<Type> InstancesWhichCannotBeFound = [];
|
||||||
|
private static readonly ConcurrentBag<Type> StaticInstancesWhichCannotBeFound = [];
|
||||||
|
|
||||||
public static TInterface LoadNewInstance<TInterface>(params object?[] args) where TInterface : class
|
public static bool TryLoadNewInstance<TInterface>([NotNullWhen(true)] out TInterface? instance, params object?[] args) where TInterface : class
|
||||||
{
|
{
|
||||||
var pluginType = GetPluginType<TInterface>();
|
var type = typeof(TInterface);
|
||||||
|
if (InstancesWhichCannotBeFound.Contains(type))
|
||||||
|
{
|
||||||
|
instance = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (TInterface)Activator.CreateInstance(pluginType, args)!;
|
if (TryGetPluginType<TInterface>(out var pluginType))
|
||||||
|
{
|
||||||
|
instance = (TInterface)Activator.CreateInstance(pluginType, args)!;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
InstancesWhichCannotBeFound.Add(type);
|
||||||
|
instance = null;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TInterface LoadStaticInstance<TInterface>(params object?[] args) where TInterface : class
|
public static bool TryLoadStaticInstance<TInterface>([NotNullWhen(true)] out TInterface? staticInstance, params object?[] args) where TInterface : class
|
||||||
{
|
{
|
||||||
var pluginType = GetPluginType<TInterface>();
|
var type = typeof(TInterface);
|
||||||
|
if (StaticInstancesWhichCannotBeFound.Contains(type))
|
||||||
|
{
|
||||||
|
staticInstance = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (TInterface)Instances.GetOrAdd(pluginType, key => Activator.CreateInstance(key, args)!);
|
if (TryGetPluginType<TInterface>(out var pluginType))
|
||||||
|
{
|
||||||
|
staticInstance = (TInterface)Instances.GetOrAdd(pluginType, key => Activator.CreateInstance(key, args)!);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticInstancesWhichCannotBeFound.Add(type);
|
||||||
|
staticInstance = null;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TInterface LoadNewInstanceByFullName<TInterface>(string implementationTypeFullName, params object?[] args) where TInterface : class
|
public static bool TryLoadNewInstanceByFullName<TInterface>([NotNullWhen(true)] out TInterface? instance, string implementationTypeFullName, params object?[] args) where TInterface : class
|
||||||
{
|
{
|
||||||
Guard.NotNullOrEmpty(implementationTypeFullName);
|
Guard.NotNullOrEmpty(implementationTypeFullName);
|
||||||
|
|
||||||
var pluginType = GetPluginTypeByFullName<TInterface>(implementationTypeFullName);
|
var type = typeof(TInterface);
|
||||||
|
if (InstancesWhichCannotBeFoundByFullName.Contains((implementationTypeFullName, type)))
|
||||||
|
{
|
||||||
|
instance = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (TInterface)Activator.CreateInstance(pluginType, args)!;
|
if (TryGetPluginTypeByFullName<TInterface>(implementationTypeFullName, out var pluginType))
|
||||||
|
{
|
||||||
|
instance = (TInterface)Activator.CreateInstance(pluginType, args)!;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
InstancesWhichCannotBeFoundByFullName.Add((implementationTypeFullName, type));
|
||||||
|
instance = null;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TInterface LoadStaticInstanceByFullName<TInterface>(string implementationTypeFullName, params object?[] args) where TInterface : class
|
public static bool TryLoadStaticInstanceByFullName<TInterface>([NotNullWhen(true)] out TInterface? staticInstance, string implementationTypeFullName, params object?[] args) where TInterface : class
|
||||||
{
|
{
|
||||||
Guard.NotNullOrEmpty(implementationTypeFullName);
|
Guard.NotNullOrEmpty(implementationTypeFullName);
|
||||||
|
|
||||||
var pluginType = GetPluginTypeByFullName<TInterface>(implementationTypeFullName);
|
var type = typeof(TInterface);
|
||||||
|
if (StaticInstancesWhichCannotBeFoundByFullName.Contains((implementationTypeFullName, type)))
|
||||||
|
{
|
||||||
|
staticInstance = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return (TInterface)Instances.GetOrAdd(pluginType, key => Activator.CreateInstance(key, args)!);
|
if (TryGetPluginTypeByFullName<TInterface>(implementationTypeFullName, out var pluginType))
|
||||||
|
{
|
||||||
|
staticInstance = (TInterface)Instances.GetOrAdd(pluginType, key => Activator.CreateInstance(key, args)!);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
StaticInstancesWhichCannotBeFoundByFullName.Add((implementationTypeFullName, type));
|
||||||
|
staticInstance = null;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Type GetPluginType<TInterface>() where TInterface : class
|
private static bool TryGetPluginType<TInterface>([NotNullWhen(true)] out Type? foundType) where TInterface : class
|
||||||
{
|
{
|
||||||
var key = typeof(TInterface).FullName!;
|
var key = typeof(TInterface).FullName!;
|
||||||
|
|
||||||
return Assemblies.GetOrAdd(key, _ =>
|
if (Assemblies.TryGetValue(key, out foundType))
|
||||||
{
|
{
|
||||||
if (TryFindTypeInDlls<TInterface>(null, out var foundType))
|
return true;
|
||||||
{
|
}
|
||||||
return foundType;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new DllNotFoundException($"No dll found which implements interface '{key}'.");
|
if (TryFindTypeInDlls<TInterface>(null, out foundType))
|
||||||
});
|
{
|
||||||
|
Assemblies.TryAdd(key, foundType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Type GetPluginTypeByFullName<TInterface>(string implementationTypeFullName) where TInterface : class
|
private static bool TryGetPluginTypeByFullName<TInterface>(string implementationTypeFullName, [NotNullWhen(true)] out Type? foundType) where TInterface : class
|
||||||
{
|
{
|
||||||
var @interface = typeof(TInterface).FullName;
|
var @interface = typeof(TInterface).FullName;
|
||||||
var key = $"{@interface}_{implementationTypeFullName}";
|
var key = $"{@interface}_{implementationTypeFullName}";
|
||||||
|
|
||||||
return Assemblies.GetOrAdd(key, _ =>
|
if (Assemblies.TryGetValue(key, out foundType))
|
||||||
{
|
{
|
||||||
if (TryFindTypeInDlls<TInterface>(implementationTypeFullName, out var foundType))
|
return true;
|
||||||
{
|
}
|
||||||
return foundType;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new DllNotFoundException($"No dll found which implements Interface '{@interface}' and has FullName '{implementationTypeFullName}'.");
|
if (TryFindTypeInDlls<TInterface>(implementationTypeFullName, out foundType))
|
||||||
});
|
{
|
||||||
|
Assemblies.TryAdd(key, foundType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TryFindTypeInDlls<TInterface>(string? implementationTypeFullName, [NotNullWhen(true)] out Type? pluginType) where TInterface : class
|
private static bool TryFindTypeInDlls<TInterface>(string? implementationTypeFullName, [NotNullWhen(true)] out Type? pluginType) where TInterface : class
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>A fluent testcontainer builder for the Docker version of WireMock.Net</Description>
|
<Description>A fluent testcontainer builder for the Docker version of WireMock.Net</Description>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
||||||
<PackageReference Include="Testcontainers" Version="4.5.0" />
|
<PackageReference Include="Testcontainers" Version="4.7.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.1.1" />
|
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
||||||
<PackageReference Include="xUnit.abstractions" Version="2.0.3" />
|
<PackageReference Include="xUnit.abstractions" Version="2.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AnyOf" Version="0.4.0" />
|
<PackageReference Include="AnyOf" Version="0.5.0.1" />
|
||||||
<PackageReference Include="RestEase" Version="1.6.4" />
|
<PackageReference Include="RestEase" Version="1.6.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
19
src/dotnet-WireMock.Net/Json/SourceGenerationContext.cs
Normal file
19
src/dotnet-WireMock.Net/Json/SourceGenerationContext.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using WireMock.Admin.Mappings;
|
||||||
|
using WireMock.Admin.Requests;
|
||||||
|
using WireMock.Types;
|
||||||
|
|
||||||
|
namespace WireMock.Net.Json;
|
||||||
|
|
||||||
|
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||||
|
[JsonSerializable(typeof(EncodingModel))]
|
||||||
|
[JsonSerializable(typeof(LogEntryModel))]
|
||||||
|
[JsonSerializable(typeof(LogRequestModel))]
|
||||||
|
[JsonSerializable(typeof(LogResponseModel))]
|
||||||
|
[JsonSerializable(typeof(LogRequestMatchModel))]
|
||||||
|
[JsonSerializable(typeof(WireMockList<string>))]
|
||||||
|
internal partial class SourceGenerationContext : JsonSerializerContext
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Text.Json;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using WireMock.Admin.Requests;
|
using WireMock.Admin.Requests;
|
||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
|
using WireMock.Net.Json;
|
||||||
|
|
||||||
namespace WireMock.Net;
|
namespace WireMock.Net;
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ public class WireMockLogger : IWireMockLogger
|
|||||||
/// <see cref="IWireMockLogger.DebugRequestResponse"/>
|
/// <see cref="IWireMockLogger.DebugRequestResponse"/>
|
||||||
public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminRequest)
|
public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminRequest)
|
||||||
{
|
{
|
||||||
string message = JsonSerializer.Serialize(logEntryModel, _options);
|
string message = JsonSerializer.Serialize(logEntryModel, SourceGenerationContext.Default.LogEntryModel);
|
||||||
|
|
||||||
_logger.LogDebug("Admin[{IsAdmin}] {Message}", isAdminRequest, message);
|
_logger.LogDebug("Admin[{IsAdmin}] {Message}", isAdminRequest, message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<PackAsTool>true</PackAsTool>
|
<PackAsTool>true</PackAsTool>
|
||||||
<ToolCommandName>dotnet-wiremock</ToolCommandName>
|
<RootNamespace>WireMock.Net</RootNamespace>
|
||||||
<Description>A dotnet commandline tool for WireMock.Net (A Lightweight Http Mocking Server for .NET)</Description>
|
<ToolCommandName>dotnet-wiremock</ToolCommandName>
|
||||||
<PackageTags>tdd;mock;http;wiremock;test;server;unittest;dotnet;tool;dotnet-tool</PackageTags>
|
<Description>A dotnet commandline tool for WireMock.Net (A Lightweight Http Mocking Server for .NET)</Description>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageTags>tdd;mock;http;wiremock;test;server;unittest;dotnet;tool;dotnet-tool</PackageTags>
|
||||||
<Authors>Stef Heyenrath</Authors>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
</PropertyGroup>
|
<Authors>Stef Heyenrath</Authors>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
||||||
<PackageReference Include="System.Text.Json" Version="8.0.5" />
|
</ItemGroup>
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj" />
|
<ProjectReference Include="..\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using FluentAssertions;
|
using AwesomeAssertions;
|
||||||
using Projects;
|
using Projects;
|
||||||
using WireMock.Net.Aspire.Tests.Facts;
|
using WireMock.Net.Aspire.Tests.Facts;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|||||||
@@ -19,15 +19,15 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.12.0" />
|
<PackageReference Include="AwesomeAssertions" Version="9.1.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="Moq" Version="4.20.70" />
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
<PackageReference Include="xunit" Version="2.8.1" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using FluentAssertions;
|
using AwesomeAssertions;
|
||||||
|
|
||||||
namespace WireMock.Net.Aspire.Tests;
|
namespace WireMock.Net.Aspire.Tests;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using FluentAssertions;
|
using AwesomeAssertions;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
||||||
namespace WireMock.Net.Aspire.Tests;
|
namespace WireMock.Net.Aspire.Tests;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using FluentAssertions;
|
using AwesomeAssertions;
|
||||||
using WireMock.Net.TestWebApplication;
|
using WireMock.Net.TestWebApplication;
|
||||||
|
|
||||||
namespace WireMock.Net.Middleware.Tests;
|
namespace WireMock.Net.Middleware.Tests;
|
||||||
|
|||||||
@@ -17,16 +17,16 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.12.0" />
|
<PackageReference Include="AwesomeAssertions" Version="9.1.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="Moq" Version="4.20.70" />
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
<PackageReference Include="xunit" Version="2.8.1" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -14,15 +14,15 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AwesomeAssertions" Version="9.0.0" />
|
<PackageReference Include="AwesomeAssertions" Version="9.1.0" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="WireMock.Net" Version="1.8.11" />
|
<PackageReference Include="WireMock.Net" Version="1.12.0" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.1">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public partial class TestcontainersTests(ITestOutputHelper testOutputHelper)
|
|||||||
var adminPassword = $"password_{Guid.NewGuid()}";
|
var adminPassword = $"password_{Guid.NewGuid()}";
|
||||||
var wireMockContainer = new WireMockContainerBuilder()
|
var wireMockContainer = new WireMockContainerBuilder()
|
||||||
.WithAdminUserNameAndPassword(adminUsername, adminPassword)
|
.WithAdminUserNameAndPassword(adminUsername, adminPassword)
|
||||||
|
.WithAutoRemove(true)
|
||||||
|
.WithCleanUp(true)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
await StartTestAsync(wireMockContainer);
|
await StartTestAsync(wireMockContainer);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using AnyOfTypes;
|
using AnyOfTypes;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
@@ -56,7 +55,7 @@ public class TypeLoaderTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LoadNewInstance()
|
public void TryLoadNewInstance()
|
||||||
{
|
{
|
||||||
var current = Directory.GetCurrentDirectory();
|
var current = Directory.GetCurrentDirectory();
|
||||||
try
|
try
|
||||||
@@ -65,10 +64,11 @@ public class TypeLoaderTests
|
|||||||
|
|
||||||
// Act
|
// Act
|
||||||
AnyOf<string, StringPattern> pattern = "x";
|
AnyOf<string, StringPattern> pattern = "x";
|
||||||
var result = TypeLoader.LoadNewInstance<ICSharpCodeMatcher>(MatchBehaviour.AcceptOnMatch, MatchOperator.Or, pattern);
|
var result = TypeLoader.TryLoadNewInstance<ICSharpCodeMatcher>(out var instance, MatchBehaviour.AcceptOnMatch, MatchOperator.Or, pattern);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().NotBeNull();
|
result.Should().BeTrue();
|
||||||
|
instance.Should().BeOfType<CSharpCodeMatcher>();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -77,63 +77,66 @@ public class TypeLoaderTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LoadNewInstanceByFullName()
|
public void TryLoadNewInstanceByFullName()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var result = TypeLoader.LoadNewInstanceByFullName<IDummyInterfaceWithImplementation>(typeof(DummyClass).FullName!);
|
var result = TypeLoader.TryLoadNewInstanceByFullName<IDummyInterfaceWithImplementation>(out var instance, typeof(DummyClass).FullName!);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeOfType<DummyClass>();
|
result.Should().BeTrue();
|
||||||
|
instance.Should().BeOfType<DummyClass>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LoadStaticInstance_ShouldOnlyCreateInstanceOnce()
|
public void TryLoadStaticInstance_ShouldOnlyCreateInstanceOnce()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var counter = new Counter();
|
var counter = new Counter();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = TypeLoader.LoadStaticInstance<IDummyInterfaceWithImplementationUsedForStaticTest>(counter);
|
var result = TypeLoader.TryLoadStaticInstance<IDummyInterfaceWithImplementationUsedForStaticTest>(out var staticInstance, counter);
|
||||||
TypeLoader.LoadStaticInstance<IDummyInterfaceWithImplementationUsedForStaticTest>(counter);
|
TypeLoader.TryLoadStaticInstance(out staticInstance, counter);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeOfType<DummyClass1UsedForStaticTest>();
|
result.Should().BeTrue();
|
||||||
|
staticInstance.Should().BeOfType<DummyClass1UsedForStaticTest>();
|
||||||
counter.Value.Should().Be(1);
|
counter.Value.Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LoadStaticInstanceByFullName_ShouldOnlyCreateInstanceOnce()
|
public void TryLoadStaticInstanceByFullName_ShouldOnlyCreateInstanceOnce()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var counter = new Counter();
|
var counter = new Counter();
|
||||||
var fullName = typeof(DummyClass2UsedForStaticTest).FullName!;
|
var fullName = typeof(DummyClass2UsedForStaticTest).FullName!;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = TypeLoader.LoadStaticInstanceByFullName<IDummyInterfaceWithImplementationUsedForStaticTest>(fullName, counter);
|
var result = TypeLoader.TryLoadStaticInstanceByFullName<IDummyInterfaceWithImplementationUsedForStaticTest>(out var staticInstance, fullName, counter);
|
||||||
TypeLoader.LoadStaticInstanceByFullName<IDummyInterfaceWithImplementationUsedForStaticTest>(fullName, counter);
|
TypeLoader.TryLoadStaticInstanceByFullName(out staticInstance, fullName, counter);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeOfType<DummyClass2UsedForStaticTest>();
|
result.Should().BeTrue();
|
||||||
|
staticInstance.Should().BeOfType<DummyClass2UsedForStaticTest>();
|
||||||
counter.Value.Should().Be(1);
|
counter.Value.Should().Be(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LoadNewInstance_ButNoImplementationFoundForInterface_ThrowsException()
|
public void TryLoadNewInstance_ButNoImplementationFoundForInterface_ReturnsFalse()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
Action a = () => TypeLoader.LoadNewInstance<IDummyInterfaceNoImplementation>();
|
var result = TypeLoader.TryLoadNewInstance<IDummyInterfaceNoImplementation>(out _);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
a.Should().Throw<DllNotFoundException>().WithMessage("No dll found which implements Interface 'WireMock.Net.Tests.Util.TypeLoaderTests+IDummyInterfaceNoImplementation'.");
|
result.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void LoadNewInstanceByFullName_ButNoImplementationFoundForInterface_ThrowsException()
|
public void TryLoadNewInstanceByFullName_ButNoImplementationFoundForInterface_ReturnsFalse()
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
Action a = () => TypeLoader.LoadNewInstanceByFullName<IDummyInterfaceWithImplementation>("xyz");
|
var result = TypeLoader.TryLoadNewInstanceByFullName<IDummyInterfaceWithImplementation>(out _, "xyz");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
a.Should().Throw<DllNotFoundException>().WithMessage("No dll found which implements Interface 'WireMock.Net.Tests.Util.TypeLoaderTests+IDummyInterfaceWithImplementation' and has FullName 'xyz'.");
|
result.Should().BeFalse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Codecov" Version="1.13.0" />
|
<PackageReference Include="Codecov" Version="1.13.0" />
|
||||||
<PackageReference Include="coverlet.msbuild" Version="3.2.0">
|
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="CultureAwareTesting.xUnit" Version="0.0.1.1" />
|
<PackageReference Include="CultureAwareTesting.xUnit" Version="0.0.1.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
Reference in New Issue
Block a user