diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6e3cd8..79a15d24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) - [#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) diff --git a/Generate-ReleaseNotes.cmd b/Generate-ReleaseNotes.cmd index 55cacec0..fc81b6b2 100644 --- a/Generate-ReleaseNotes.cmd +++ b/Generate-ReleaseNotes.cmd @@ -1,6 +1,6 @@ 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% diff --git a/PackageReleaseNotes.txt b/PackageReleaseNotes.txt index 35cd24e1..abe2b249 100644 --- a/PackageReleaseNotes.txt +++ b/PackageReleaseNotes.txt @@ -1,9 +1,5 @@ -# 1.11.2 (27 August 2025) -- #1352 Add additional try-catch to TypeLoader logic [feature] -- #1354 Add System.Net.Http again to solve CVE warning [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] +# 1.12.0 (30 August 2025) +- #1357 Upgrade Testcontainers to 4.7.0 [feature] +- #1356 WireMock.Net 1.11.2 is not compatible with TestContainers 4.7.0 [bug] The full release notes can be found here: https://github.com/wiremock/WireMock.Net/blob/master/CHANGELOG.md \ No newline at end of file diff --git a/WireMock.Net Solution.sln b/WireMock.Net Solution.sln index 89ca8789..3af1a3cc 100644 --- a/WireMock.Net Solution.sln +++ b/WireMock.Net Solution.sln @@ -68,14 +68,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Org.RestClient", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Org.Abstractions", "src\WireMock.Org.Abstractions\WireMock.Org.Abstractions.csproj", "{3BA5109E-5F30-4CC2-B699-02EC82560AA6}" 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}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.xUnit", "src\WireMock.Net.xUnit\WireMock.Net.xUnit.csproj", "{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}" 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}" EndProject 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 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.ProtoBuf", "src\WireMock.Net.ProtoBuf\WireMock.Net.ProtoBuf.csproj", "{B47413AA-55D3-49A7-896A-17ADBFF72407}" 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 GlobalSection(SolutionConfigurationPlatforms) = preSolution 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}.Release|Any CPU.ActiveCfg = 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.Build.0 = Debug|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}.Release|Any CPU.ActiveCfg = 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.Build.0 = Debug|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}.Release|Any CPU.ActiveCfg = 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 GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -371,10 +371,8 @@ Global {5B64F6CA-BF6B-4F67-BB2A-9C47E441703E} = {7EFB2C5B-1BB2-4AAF-BC9F-216ED80C594D} {08B29DB1-FEFE-408A-AD0A-6BA6DDC8D70F} = {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} {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} {12B016A5-9D8B-4EFE-96C2-CA51BE43367D} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2} {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} {1E874C8F-08A2-493B-8421-619F9A6E9E77} = {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 GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458} diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/HowTo.txt b/examples/WireMock.Net.Console.NET8.WithCertificate/HowTo.txt similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/HowTo.txt rename to examples/WireMock.Net.Console.NET8.WithCertificate/HowTo.txt diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/Program.cs b/examples/WireMock.Net.Console.NET8.WithCertificate/Program.cs similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/Program.cs rename to examples/WireMock.Net.Console.NET8.WithCertificate/Program.cs diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/WireMock.Net.Console.NET6.WithCertificate.csproj b/examples/WireMock.Net.Console.NET8.WithCertificate/WireMock.Net.Console.NET8.WithCertificate.csproj similarity index 95% rename from examples/WireMock.Net.Console.NET6.WithCertificate/WireMock.Net.Console.NET6.WithCertificate.csproj rename to examples/WireMock.Net.Console.NET8.WithCertificate/WireMock.Net.Console.NET8.WithCertificate.csproj index 1415e9ac..3bb6ff86 100644 --- a/examples/WireMock.Net.Console.NET6.WithCertificate/WireMock.Net.Console.NET6.WithCertificate.csproj +++ b/examples/WireMock.Net.Console.NET8.WithCertificate/WireMock.Net.Console.NET8.WithCertificate.csproj @@ -7,7 +7,7 @@ - + diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/cert-rsa.pem b/examples/WireMock.Net.Console.NET8.WithCertificate/cert-rsa.pem similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/cert-rsa.pem rename to examples/WireMock.Net.Console.NET8.WithCertificate/cert-rsa.pem diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/cert.pem b/examples/WireMock.Net.Console.NET8.WithCertificate/cert.pem similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/cert.pem rename to examples/WireMock.Net.Console.NET8.WithCertificate/cert.pem diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/private-key-rsa.pem b/examples/WireMock.Net.Console.NET8.WithCertificate/private-key-rsa.pem similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/private-key-rsa.pem rename to examples/WireMock.Net.Console.NET8.WithCertificate/private-key-rsa.pem diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/private-key.pem b/examples/WireMock.Net.Console.NET8.WithCertificate/private-key.pem similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/private-key.pem rename to examples/WireMock.Net.Console.NET8.WithCertificate/private-key.pem diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/public-key-rsa.pem b/examples/WireMock.Net.Console.NET8.WithCertificate/public-key-rsa.pem similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/public-key-rsa.pem rename to examples/WireMock.Net.Console.NET8.WithCertificate/public-key-rsa.pem diff --git a/examples/WireMock.Net.Console.NET6.WithCertificate/public-key.pem b/examples/WireMock.Net.Console.NET8.WithCertificate/public-key.pem similarity index 100% rename from examples/WireMock.Net.Console.NET6.WithCertificate/public-key.pem rename to examples/WireMock.Net.Console.NET8.WithCertificate/public-key.pem diff --git a/examples/WireMock.Net.Console.NET8/WireMock.Net.Console.NET8.csproj b/examples/WireMock.Net.Console.NET8/WireMock.Net.Console.NET8.csproj index b4858814..f8eaf571 100644 --- a/examples/WireMock.Net.Console.NET8/WireMock.Net.Console.NET8.csproj +++ b/examples/WireMock.Net.Console.NET8/WireMock.Net.Console.NET8.csproj @@ -1,34 +1,34 @@ - - Exe - net8.0 - $(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF - + + Exe + net8.0 + + - - - PreserveNewest - - + + + PreserveNewest + + - - - + + + - - - - - + + + + + - - - PreserveNewest - - - PreserveNewest - - + + + PreserveNewest + + + PreserveNewest + + \ No newline at end of file diff --git a/examples/WireMock.Net.Console.Proxy.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj b/examples/WireMock.Net.Console.Proxy.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj index bdd303f5..9d047dd5 100644 --- a/examples/WireMock.Net.Console.Proxy.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj +++ b/examples/WireMock.Net.Console.Proxy.NETCoreApp/WireMock.Net.Console.Proxy.NETCoreApp.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 ../../resources/WireMock.Net-Logo.ico diff --git a/examples/WireMock.Net.ConsoleApp.UsingNuGet/WireMock.Net.ConsoleApp.UsingNuGet.csproj b/examples/WireMock.Net.ConsoleApp.UsingNuGet/WireMock.Net.ConsoleApp.UsingNuGet.csproj index fdc43fac..54836452 100644 --- a/examples/WireMock.Net.ConsoleApp.UsingNuGet/WireMock.Net.ConsoleApp.UsingNuGet.csproj +++ b/examples/WireMock.Net.ConsoleApp.UsingNuGet/WireMock.Net.ConsoleApp.UsingNuGet.csproj @@ -7,16 +7,16 @@ enable - + - + + + \ No newline at end of file diff --git a/examples/WireMock.Net.Service/WireMock.Net.Service.csproj b/examples/WireMock.Net.Service/WireMock.Net.Service.csproj index 878a13ef..3721b4e4 100644 --- a/examples/WireMock.Net.Service/WireMock.Net.Service.csproj +++ b/examples/WireMock.Net.Service/WireMock.Net.Service.csproj @@ -115,10 +115,10 @@ - 3.0.3 + 3.2.0 - 1.8.11 + 1.12.0 diff --git a/examples/WireMock.Net.WebApplication.NET6/App.cs b/examples/WireMock.Net.WebApplication.IIS/App.cs similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/App.cs rename to examples/WireMock.Net.WebApplication.IIS/App.cs diff --git a/examples/WireMock.Net.WebApplication.NET6/IWireMockService.cs b/examples/WireMock.Net.WebApplication.IIS/IWireMockService.cs similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/IWireMockService.cs rename to examples/WireMock.Net.WebApplication.IIS/IWireMockService.cs diff --git a/examples/WireMock.Net.WebApplication.NET6/Program.cs b/examples/WireMock.Net.WebApplication.IIS/Program.cs similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/Program.cs rename to examples/WireMock.Net.WebApplication.IIS/Program.cs diff --git a/examples/WireMock.Net.WebApplication.NET6/Properties/ServiceDependencies/WireMockNetWebApplicationNET6Linux - Zip Deploy/profile.arm.json b/examples/WireMock.Net.WebApplication.IIS/Properties/ServiceDependencies/WireMockNetWebApplicationNET6Linux - Zip Deploy/profile.arm.json similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/Properties/ServiceDependencies/WireMockNetWebApplicationNET6Linux - Zip Deploy/profile.arm.json rename to examples/WireMock.Net.WebApplication.IIS/Properties/ServiceDependencies/WireMockNetWebApplicationNET6Linux - Zip Deploy/profile.arm.json diff --git a/examples/WireMock.Net.WebApplication.NET6/Properties/launchSettings.json b/examples/WireMock.Net.WebApplication.IIS/Properties/launchSettings.json similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/Properties/launchSettings.json rename to examples/WireMock.Net.WebApplication.IIS/Properties/launchSettings.json diff --git a/examples/WireMock.Net.WebApplication.NET6/WireMock.Net.WebApplication.NET6.csproj b/examples/WireMock.Net.WebApplication.IIS/WireMock.Net.WebApplication.IIS.csproj similarity index 92% rename from examples/WireMock.Net.WebApplication.NET6/WireMock.Net.WebApplication.NET6.csproj rename to examples/WireMock.Net.WebApplication.IIS/WireMock.Net.WebApplication.IIS.csproj index f6a66ee9..d4b3e2be 100644 --- a/examples/WireMock.Net.WebApplication.NET6/WireMock.Net.WebApplication.NET6.csproj +++ b/examples/WireMock.Net.WebApplication.IIS/WireMock.Net.WebApplication.IIS.csproj @@ -1,7 +1,7 @@ - net6 + net8.0 WireMock.Net.WebApplication.Program WireMock.Net.WebApplication @@ -11,7 +11,7 @@ - + diff --git a/examples/WireMock.Net.WebApplication.NET6/WireMockService.cs b/examples/WireMock.Net.WebApplication.IIS/WireMockService.cs similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/WireMockService.cs rename to examples/WireMock.Net.WebApplication.IIS/WireMockService.cs diff --git a/examples/WireMock.Net.WebApplication.NET6/__admin/mappings/1e0686d3-5eb0-4c30-9482-db3735a1e4c4.json b/examples/WireMock.Net.WebApplication.IIS/__admin/mappings/1e0686d3-5eb0-4c30-9482-db3735a1e4c4.json similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/__admin/mappings/1e0686d3-5eb0-4c30-9482-db3735a1e4c4.json rename to examples/WireMock.Net.WebApplication.IIS/__admin/mappings/1e0686d3-5eb0-4c30-9482-db3735a1e4c4.json diff --git a/examples/WireMock.Net.WebApplication.NET6/appsettings.json b/examples/WireMock.Net.WebApplication.IIS/appsettings.json similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/appsettings.json rename to examples/WireMock.Net.WebApplication.IIS/appsettings.json diff --git a/examples/WireMock.Net.WebApplication.NET6/readme.md b/examples/WireMock.Net.WebApplication.IIS/readme.md similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/readme.md rename to examples/WireMock.Net.WebApplication.IIS/readme.md diff --git a/examples/WireMock.Net.WebApplication.NET6/web.config b/examples/WireMock.Net.WebApplication.IIS/web.config similarity index 100% rename from examples/WireMock.Net.WebApplication.NET6/web.config rename to examples/WireMock.Net.WebApplication.IIS/web.config diff --git a/examples/WireMockAzureQueueExample/WireMockAzureQueueExample.csproj b/examples/WireMockAzureQueueExample/WireMockAzureQueueExample.csproj index f4ad7664..e3050ada 100644 --- a/examples/WireMockAzureQueueExample/WireMockAzureQueueExample.csproj +++ b/examples/WireMockAzureQueueExample/WireMockAzureQueueExample.csproj @@ -1,25 +1,25 @@ - - net6.0 - v4 - bb7d8355-68c4-4f81-8c2d-6cdd80cd7602 - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - Never - - + + net8.0 + v4 + bb7d8355-68c4-4f81-8c2d-6cdd80cd7602 + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + Never + + diff --git a/examples/WireMockAzureQueueProxy/WireMockAzureQueueProxy.csproj b/examples/WireMockAzureQueueProxy/WireMockAzureQueueProxy.csproj index e516dbde..1e67daa9 100644 --- a/examples/WireMockAzureQueueProxy/WireMockAzureQueueProxy.csproj +++ b/examples/WireMockAzureQueueProxy/WireMockAzureQueueProxy.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/src/WireMock.Net.Abstractions/Admin/Requests/LogRequestMatchModel.cs b/src/WireMock.Net.Abstractions/Admin/Requests/LogRequestMatchModel.cs index 6a379627..05212618 100644 --- a/src/WireMock.Net.Abstractions/Admin/Requests/LogRequestMatchModel.cs +++ b/src/WireMock.Net.Abstractions/Admin/Requests/LogRequestMatchModel.cs @@ -47,5 +47,5 @@ public class LogRequestMatchModel /// /// The match details. /// - public IList MatchDetails { get; set; } + public IList MatchDetails { get; set; } = []; } \ No newline at end of file diff --git a/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj b/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj index af89aadc..151bec75 100644 --- a/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj +++ b/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj @@ -33,7 +33,7 @@ - + diff --git a/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj b/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj index f562ec64..46da5f42 100644 --- a/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj +++ b/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/WireMock.Net.MimePart/Util/MimeKitUtils.cs b/src/WireMock.Net.MimePart/Util/MimeKitUtils.cs index f97d9232..9c39b79b 100644 --- a/src/WireMock.Net.MimePart/Util/MimeKitUtils.cs +++ b/src/WireMock.Net.MimePart/Util/MimeKitUtils.cs @@ -1,7 +1,6 @@ // Copyright © WireMock.Net using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; @@ -33,16 +32,25 @@ internal class MimeKitUtils : IMimeKitUtils 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. - 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. - 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]); diff --git a/src/WireMock.Net.Minimal/Matchers/Request/RequestMessageMultiPartMatcher.cs b/src/WireMock.Net.Minimal/Matchers/Request/RequestMessageMultiPartMatcher.cs index 84a23ce7..31e2ff93 100644 --- a/src/WireMock.Net.Minimal/Matchers/Request/RequestMessageMultiPartMatcher.cs +++ b/src/WireMock.Net.Minimal/Matchers/Request/RequestMessageMultiPartMatcher.cs @@ -12,7 +12,7 @@ namespace WireMock.Matchers.Request; /// public class RequestMessageMultiPartMatcher : IRequestMatcher { - private static readonly IMimeKitUtils MimeKitUtils = TypeLoader.LoadStaticInstance(); + private readonly IMimeKitUtils _mimeKitUtils = LoadMimeKitUtils(); /// /// The matchers. @@ -62,7 +62,7 @@ public class RequestMessageMultiPartMatcher : IRequestMatcher 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); } @@ -96,4 +96,14 @@ public class RequestMessageMultiPartMatcher : IRequestMatcher return requestMatchResult.AddScore(GetType(), score, exception); } + + private static IMimeKitUtils LoadMimeKitUtils() + { + if (TypeLoader.TryLoadStaticInstance(out var mimeKitUtils)) + { + return mimeKitUtils; + } + + throw new InvalidOperationException("MimeKit is required for RequestMessageMultiPartMatcher. Please install the WireMock.Net.MimePart package."); + } } \ No newline at end of file diff --git a/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs b/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs index cb62cd06..8dbb1f99 100644 --- a/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs +++ b/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs @@ -179,9 +179,12 @@ namespace WireMock.Owin.Mappers return (bodyData.Encoding ?? _utf8NoBom).GetBytes(jsonBody); case BodyType.ProtoBuf: - var protoDefinitions = bodyData.ProtoDefinition?.Invoke().Texts; - var protoBufUtils = TypeLoader.LoadStaticInstance(); - return await protoBufUtils.GetProtoBufMessageWithHeaderAsync(protoDefinitions, bodyData.ProtoBufMessageType, bodyData.BodyAsJson).ConfigureAwait(false); + if (TypeLoader.TryLoadStaticInstance(out var protoBufUtils)) + { + var protoDefinitions = bodyData.ProtoDefinition?.Invoke().Texts; + return await protoBufUtils.GetProtoBufMessageWithHeaderAsync(protoDefinitions, bodyData.ProtoBufMessageType, bodyData.BodyAsJson).ConfigureAwait(false); + } + break; case BodyType.Bytes: return bodyData.BodyAsBytes; diff --git a/src/WireMock.Net.Minimal/RequestMessage.cs b/src/WireMock.Net.Minimal/RequestMessage.cs index 300ef7ff..8987e338 100644 --- a/src/WireMock.Net.Minimal/RequestMessage.cs +++ b/src/WireMock.Net.Minimal/RequestMessage.cs @@ -184,16 +184,9 @@ public class RequestMessage : IRequestMessage //#endif #if MIMEKIT - try + if (TypeLoader.TryLoadStaticInstance(out var mimeKitUtils) && mimeKitUtils.TryGetMimeMessage(this, out var mimeMessage)) { - if (TypeLoader.LoadStaticInstance().TryGetMimeMessage(this, out var mimeMessage)) - { - BodyAsMimeMessage = mimeMessage; - } - } - catch - { - // Ignore exception from MimeMessage.Load + BodyAsMimeMessage = mimeMessage; } #endif } diff --git a/src/WireMock.Net.Minimal/Serialization/MatcherMapper.cs b/src/WireMock.Net.Minimal/Serialization/MatcherMapper.cs index 429ac679..39ad8fa4 100644 --- a/src/WireMock.Net.Minimal/Serialization/MatcherMapper.cs +++ b/src/WireMock.Net.Minimal/Serialization/MatcherMapper.cs @@ -55,7 +55,12 @@ internal class MatcherMapper case "CSharpCodeMatcher": if (_settings.AllowCSharpCodeMatcher == true) { - return TypeLoader.LoadNewInstance(matchBehaviour, matchOperator, stringPatterns); + if (TypeLoader.TryLoadNewInstance(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'."); @@ -75,7 +80,12 @@ internal class MatcherMapper case "GraphQLMatcher": var patternAsString = stringPatterns[0].GetPattern(); var schema = new AnyOf(patternAsString); - return TypeLoader.LoadNewInstance(schema, matcherModel.CustomScalars, matchBehaviour, matchOperator); + if (TypeLoader.TryLoadNewInstance(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": return CreateMimePartMatcher(matchBehaviour, matcherModel); @@ -282,18 +292,34 @@ internal class MatcherMapper var contentTransferEncodingMatcher = Map(matcher.ContentTransferEncodingMatcher) as IStringMatcher; var contentMatcher = Map(matcher.ContentMatcher); - return TypeLoader.LoadNewInstance(matchBehaviour, contentTypeMatcher, contentDispositionMatcher, contentTransferEncodingMatcher, contentMatcher); + if (TypeLoader.TryLoadNewInstance( + 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 protoDefinitions, MatcherModel matcher) { var objectMatcher = Map(matcher.ContentMatcher) as IObjectMatcher; - return TypeLoader.LoadNewInstance( + if (TypeLoader.TryLoadNewInstance( + out var protobufMatcher, () => ProtoDefinitionUtils.GetIdOrTexts(_settings, protoDefinitions.ToArray()), matcher.ProtoBufMessageType!, matchBehaviour ?? MatchBehaviour.AcceptOnMatch, - objectMatcher - ); + objectMatcher)) + { + return protobufMatcher; + } + + throw new InvalidOperationException("The 'ProtoBufMatcher' cannot be loaded. Please install the WireMock.Net.ProtoBuf package."); } } \ No newline at end of file diff --git a/src/WireMock.Net.Minimal/Server/WireMockServer.ConvertMapping.cs b/src/WireMock.Net.Minimal/Server/WireMockServer.ConvertMapping.cs index d345b057..d0f7622b 100644 --- a/src/WireMock.Net.Minimal/Server/WireMockServer.ConvertMapping.cs +++ b/src/WireMock.Net.Minimal/Server/WireMockServer.ConvertMapping.cs @@ -366,10 +366,8 @@ public partial class WireMockServer } else if (responseModel.BodyAsJson != null) { - if (responseModel.ProtoBufMessageType != null) + if (responseModel.ProtoBufMessageType != null && TypeLoader.TryLoadStaticInstance(out var protoBufUtils)) { - var protoBufUtils = TypeLoader.LoadStaticInstance(); - if (responseModel.ProtoDefinition != null) { responseBuilder = protoBufUtils.UpdateResponseBuilder(responseBuilder, responseModel.ProtoBufMessageType, responseModel.BodyAsJson, responseModel.ProtoDefinition); diff --git a/src/WireMock.Net.Shared/Matchers/Request/RequestMessageGraphQLMatcher.cs b/src/WireMock.Net.Shared/Matchers/Request/RequestMessageGraphQLMatcher.cs index 613d58f8..313be8e5 100644 --- a/src/WireMock.Net.Shared/Matchers/Request/RequestMessageGraphQLMatcher.cs +++ b/src/WireMock.Net.Shared/Matchers/Request/RequestMessageGraphQLMatcher.cs @@ -100,7 +100,10 @@ public class RequestMessageGraphQLMatcher : IRequestMatcher IDictionary? customScalars ) { - var graphQLMatcher = TypeLoader.LoadNewInstance(schema, customScalars, matchBehaviour, MatchOperator.Or); - return [graphQLMatcher]; + if (TypeLoader.TryLoadNewInstance(out var graphQLMatcher, schema, customScalars, matchBehaviour, MatchOperator.Or)) + { + return [graphQLMatcher]; + } + return []; } } \ No newline at end of file diff --git a/src/WireMock.Net.Shared/Matchers/Request/RequestMessageProtoBufMatcher.cs b/src/WireMock.Net.Shared/Matchers/Request/RequestMessageProtoBufMatcher.cs index 372bd906..42b10daa 100644 --- a/src/WireMock.Net.Shared/Matchers/Request/RequestMessageProtoBufMatcher.cs +++ b/src/WireMock.Net.Shared/Matchers/Request/RequestMessageProtoBufMatcher.cs @@ -25,7 +25,10 @@ public class RequestMessageProtoBufMatcher : IRequestMatcher /// The optional matcher to use to match the ProtoBuf as (json) object. public RequestMessageProtoBufMatcher(MatchBehaviour matchBehaviour, Func protoDefinition, string messageType, IObjectMatcher? matcher = null) { - Matcher = TypeLoader.LoadNewInstance(protoDefinition, messageType, matchBehaviour, matcher); + if (TypeLoader.TryLoadNewInstance(out var protoBufMatcher, protoDefinition, messageType, matchBehaviour, matcher)) + { + Matcher = protoBufMatcher; + } } /// diff --git a/src/WireMock.Net.Shared/Util/TypeLoader.cs b/src/WireMock.Net.Shared/Util/TypeLoader.cs index 2f631297..dabd8e9b 100644 --- a/src/WireMock.Net.Shared/Util/TypeLoader.cs +++ b/src/WireMock.Net.Shared/Util/TypeLoader.cs @@ -14,68 +14,130 @@ internal static class TypeLoader { private static readonly ConcurrentDictionary Assemblies = new(); private static readonly ConcurrentDictionary Instances = new(); + private static readonly ConcurrentBag<(string FullName, Type Type)> InstancesWhichCannotBeFoundByFullName = []; + private static readonly ConcurrentBag<(string FullName, Type Type)> StaticInstancesWhichCannotBeFoundByFullName = []; + private static readonly ConcurrentBag InstancesWhichCannotBeFound = []; + private static readonly ConcurrentBag StaticInstancesWhichCannotBeFound = []; - public static TInterface LoadNewInstance(params object?[] args) where TInterface : class + public static bool TryLoadNewInstance([NotNullWhen(true)] out TInterface? instance, params object?[] args) where TInterface : class { - var pluginType = GetPluginType(); + var type = typeof(TInterface); + if (InstancesWhichCannotBeFound.Contains(type)) + { + instance = null; + return false; + } - return (TInterface)Activator.CreateInstance(pluginType, args)!; + if (TryGetPluginType(out var pluginType)) + { + instance = (TInterface)Activator.CreateInstance(pluginType, args)!; + return true; + } + + InstancesWhichCannotBeFound.Add(type); + instance = null; + return false; } - public static TInterface LoadStaticInstance(params object?[] args) where TInterface : class + public static bool TryLoadStaticInstance([NotNullWhen(true)] out TInterface? staticInstance, params object?[] args) where TInterface : class { - var pluginType = GetPluginType(); + var type = typeof(TInterface); + if (StaticInstancesWhichCannotBeFound.Contains(type)) + { + staticInstance = null; + return false; + } - return (TInterface)Instances.GetOrAdd(pluginType, key => Activator.CreateInstance(key, args)!); + if (TryGetPluginType(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(string implementationTypeFullName, params object?[] args) where TInterface : class + public static bool TryLoadNewInstanceByFullName([NotNullWhen(true)] out TInterface? instance, string implementationTypeFullName, params object?[] args) where TInterface : class { Guard.NotNullOrEmpty(implementationTypeFullName); - var pluginType = GetPluginTypeByFullName(implementationTypeFullName); + var type = typeof(TInterface); + if (InstancesWhichCannotBeFoundByFullName.Contains((implementationTypeFullName, type))) + { + instance = null; + return false; + } - return (TInterface)Activator.CreateInstance(pluginType, args)!; + if (TryGetPluginTypeByFullName(implementationTypeFullName, out var pluginType)) + { + instance = (TInterface)Activator.CreateInstance(pluginType, args)!; + return true; + } + + InstancesWhichCannotBeFoundByFullName.Add((implementationTypeFullName, type)); + instance = null; + return false; } - public static TInterface LoadStaticInstanceByFullName(string implementationTypeFullName, params object?[] args) where TInterface : class + public static bool TryLoadStaticInstanceByFullName([NotNullWhen(true)] out TInterface? staticInstance, string implementationTypeFullName, params object?[] args) where TInterface : class { Guard.NotNullOrEmpty(implementationTypeFullName); - var pluginType = GetPluginTypeByFullName(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(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() where TInterface : class + private static bool TryGetPluginType([NotNullWhen(true)] out Type? foundType) where TInterface : class { var key = typeof(TInterface).FullName!; - return Assemblies.GetOrAdd(key, _ => + if (Assemblies.TryGetValue(key, out foundType)) { - if (TryFindTypeInDlls(null, out var foundType)) - { - return foundType; - } + return true; + } - throw new DllNotFoundException($"No dll found which implements interface '{key}'."); - }); + if (TryFindTypeInDlls(null, out foundType)) + { + Assemblies.TryAdd(key, foundType); + return true; + } + + return false; } - private static Type GetPluginTypeByFullName(string implementationTypeFullName) where TInterface : class + private static bool TryGetPluginTypeByFullName(string implementationTypeFullName, [NotNullWhen(true)] out Type? foundType) where TInterface : class { var @interface = typeof(TInterface).FullName; var key = $"{@interface}_{implementationTypeFullName}"; - return Assemblies.GetOrAdd(key, _ => + if (Assemblies.TryGetValue(key, out foundType)) { - if (TryFindTypeInDlls(implementationTypeFullName, out var foundType)) - { - return foundType; - } + return true; + } - throw new DllNotFoundException($"No dll found which implements Interface '{@interface}' and has FullName '{implementationTypeFullName}'."); - }); + if (TryFindTypeInDlls(implementationTypeFullName, out foundType)) + { + Assemblies.TryAdd(key, foundType); + return true; + } + + return false; } private static bool TryFindTypeInDlls(string? implementationTypeFullName, [NotNullWhen(true)] out Type? pluginType) where TInterface : class diff --git a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj index 2f95a43d..72bf08e9 100644 --- a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj +++ b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj @@ -1,4 +1,4 @@ - + A fluent testcontainer builder for the Docker version of WireMock.Net @@ -39,7 +39,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj b/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj index 33a212ab..31b3f3f5 100644 --- a/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj +++ b/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj @@ -27,7 +27,7 @@ - + diff --git a/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj b/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj index 31dc8eef..457c7b2e 100644 --- a/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj +++ b/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj @@ -34,7 +34,7 @@ - + diff --git a/src/dotnet-WireMock.Net/Json/SourceGenerationContext.cs b/src/dotnet-WireMock.Net/Json/SourceGenerationContext.cs new file mode 100644 index 00000000..ba7312ff --- /dev/null +++ b/src/dotnet-WireMock.Net/Json/SourceGenerationContext.cs @@ -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))] +internal partial class SourceGenerationContext : JsonSerializerContext +{ +} \ No newline at end of file diff --git a/src/dotnet-WireMock.Net/WireMockLogger.cs b/src/dotnet-WireMock.Net/WireMockLogger.cs index 29a03b70..08398fac 100644 --- a/src/dotnet-WireMock.Net/WireMockLogger.cs +++ b/src/dotnet-WireMock.Net/WireMockLogger.cs @@ -5,6 +5,7 @@ using System.Text.Json; using Microsoft.Extensions.Logging; using WireMock.Admin.Requests; using WireMock.Logging; +using WireMock.Net.Json; namespace WireMock.Net; @@ -55,7 +56,7 @@ public class WireMockLogger : IWireMockLogger /// 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); } diff --git a/src/dotnet-WireMock.Net/dotnet-WireMock.csproj b/src/dotnet-WireMock.Net/dotnet-WireMock.csproj index 68e4db87..f4e98993 100644 --- a/src/dotnet-WireMock.Net/dotnet-WireMock.csproj +++ b/src/dotnet-WireMock.Net/dotnet-WireMock.csproj @@ -1,27 +1,27 @@ - + - - Exe - net8.0 - true - dotnet-wiremock - A dotnet commandline tool for WireMock.Net (A Lightweight Http Mocking Server for .NET) - tdd;mock;http;wiremock;test;server;unittest;dotnet;tool;dotnet-tool - MIT - Stef Heyenrath - + + Exe + net8.0 + true + WireMock.Net + dotnet-wiremock + A dotnet commandline tool for WireMock.Net (A Lightweight Http Mocking Server for .NET) + tdd;mock;http;wiremock;test;server;unittest;dotnet;tool;dotnet-tool + MIT + Stef Heyenrath + - - true - + + true + - - - - + + + - - - + + + \ No newline at end of file diff --git a/test/WireMock.Net.Aspire.Tests/IntegrationTests.cs b/test/WireMock.Net.Aspire.Tests/IntegrationTests.cs index e51c2d9b..1470c836 100644 --- a/test/WireMock.Net.Aspire.Tests/IntegrationTests.cs +++ b/test/WireMock.Net.Aspire.Tests/IntegrationTests.cs @@ -1,7 +1,7 @@ // Copyright © WireMock.Net using System.Net.Http.Json; -using FluentAssertions; +using AwesomeAssertions; using Projects; using WireMock.Net.Aspire.Tests.Facts; using Xunit.Abstractions; diff --git a/test/WireMock.Net.Aspire.Tests/WireMock.Net.Aspire.Tests.csproj b/test/WireMock.Net.Aspire.Tests/WireMock.Net.Aspire.Tests.csproj index 51a115cf..6b11ee4c 100644 --- a/test/WireMock.Net.Aspire.Tests/WireMock.Net.Aspire.Tests.csproj +++ b/test/WireMock.Net.Aspire.Tests/WireMock.Net.Aspire.Tests.csproj @@ -19,15 +19,15 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/WireMock.Net.Aspire.Tests/WireMockServerArgumentsTests.cs b/test/WireMock.Net.Aspire.Tests/WireMockServerArgumentsTests.cs index 15a4ca3c..8e20284b 100644 --- a/test/WireMock.Net.Aspire.Tests/WireMockServerArgumentsTests.cs +++ b/test/WireMock.Net.Aspire.Tests/WireMockServerArgumentsTests.cs @@ -1,6 +1,6 @@ // Copyright © WireMock.Net -using FluentAssertions; +using AwesomeAssertions; namespace WireMock.Net.Aspire.Tests; diff --git a/test/WireMock.Net.Aspire.Tests/WireMockServerBuilderExtensionsTests.cs b/test/WireMock.Net.Aspire.Tests/WireMockServerBuilderExtensionsTests.cs index a2c1f15d..afa42e3e 100644 --- a/test/WireMock.Net.Aspire.Tests/WireMockServerBuilderExtensionsTests.cs +++ b/test/WireMock.Net.Aspire.Tests/WireMockServerBuilderExtensionsTests.cs @@ -1,7 +1,7 @@ // Copyright © WireMock.Net using System.Net.Sockets; -using FluentAssertions; +using AwesomeAssertions; using Moq; namespace WireMock.Net.Aspire.Tests; diff --git a/test/WireMock.Net.Middleware.Tests/IntegrationTests.cs b/test/WireMock.Net.Middleware.Tests/IntegrationTests.cs index 8cac376e..9326f43c 100644 --- a/test/WireMock.Net.Middleware.Tests/IntegrationTests.cs +++ b/test/WireMock.Net.Middleware.Tests/IntegrationTests.cs @@ -1,6 +1,6 @@ // Copyright © WireMock.Net -using FluentAssertions; +using AwesomeAssertions; using WireMock.Net.TestWebApplication; namespace WireMock.Net.Middleware.Tests; diff --git a/test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj b/test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj index fec8bdf6..8d7b7dab 100644 --- a/test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj +++ b/test/WireMock.Net.Middleware.Tests/WireMock.Net.Middleware.Tests.csproj @@ -17,16 +17,16 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/WireMock.Net.Tests.UsingNuGet/WireMock.Net.Tests.UsingNuGet.csproj b/test/WireMock.Net.Tests.UsingNuGet/WireMock.Net.Tests.UsingNuGet.csproj index 4facbda3..186eca8e 100644 --- a/test/WireMock.Net.Tests.UsingNuGet/WireMock.Net.Tests.UsingNuGet.csproj +++ b/test/WireMock.Net.Tests.UsingNuGet/WireMock.Net.Tests.UsingNuGet.csproj @@ -14,15 +14,15 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.cs b/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.cs index ba5bb4bf..cb1be050 100644 --- a/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.cs +++ b/test/WireMock.Net.Tests/Testcontainers/TestcontainersTests.cs @@ -25,6 +25,8 @@ public partial class TestcontainersTests(ITestOutputHelper testOutputHelper) var adminPassword = $"password_{Guid.NewGuid()}"; var wireMockContainer = new WireMockContainerBuilder() .WithAdminUserNameAndPassword(adminUsername, adminPassword) + .WithAutoRemove(true) + .WithCleanUp(true) .Build(); await StartTestAsync(wireMockContainer); diff --git a/test/WireMock.Net.Tests/Util/TypeLoaderTests.cs b/test/WireMock.Net.Tests/Util/TypeLoaderTests.cs index 6b591f6e..e37a6bdb 100644 --- a/test/WireMock.Net.Tests/Util/TypeLoaderTests.cs +++ b/test/WireMock.Net.Tests/Util/TypeLoaderTests.cs @@ -1,6 +1,5 @@ // Copyright © WireMock.Net -using System; using System.IO; using AnyOfTypes; using FluentAssertions; @@ -56,7 +55,7 @@ public class TypeLoaderTests } [Fact] - public void LoadNewInstance() + public void TryLoadNewInstance() { var current = Directory.GetCurrentDirectory(); try @@ -65,10 +64,11 @@ public class TypeLoaderTests // Act AnyOf pattern = "x"; - var result = TypeLoader.LoadNewInstance(MatchBehaviour.AcceptOnMatch, MatchOperator.Or, pattern); + var result = TypeLoader.TryLoadNewInstance(out var instance, MatchBehaviour.AcceptOnMatch, MatchOperator.Or, pattern); // Assert - result.Should().NotBeNull(); + result.Should().BeTrue(); + instance.Should().BeOfType(); } finally { @@ -77,63 +77,66 @@ public class TypeLoaderTests } [Fact] - public void LoadNewInstanceByFullName() + public void TryLoadNewInstanceByFullName() { // Act - var result = TypeLoader.LoadNewInstanceByFullName(typeof(DummyClass).FullName!); + var result = TypeLoader.TryLoadNewInstanceByFullName(out var instance, typeof(DummyClass).FullName!); // Assert - result.Should().BeOfType(); + result.Should().BeTrue(); + instance.Should().BeOfType(); } [Fact] - public void LoadStaticInstance_ShouldOnlyCreateInstanceOnce() + public void TryLoadStaticInstance_ShouldOnlyCreateInstanceOnce() { // Arrange var counter = new Counter(); // Act - var result = TypeLoader.LoadStaticInstance(counter); - TypeLoader.LoadStaticInstance(counter); + var result = TypeLoader.TryLoadStaticInstance(out var staticInstance, counter); + TypeLoader.TryLoadStaticInstance(out staticInstance, counter); // Assert - result.Should().BeOfType(); + result.Should().BeTrue(); + staticInstance.Should().BeOfType(); counter.Value.Should().Be(1); } [Fact] - public void LoadStaticInstanceByFullName_ShouldOnlyCreateInstanceOnce() + public void TryLoadStaticInstanceByFullName_ShouldOnlyCreateInstanceOnce() { // Arrange var counter = new Counter(); var fullName = typeof(DummyClass2UsedForStaticTest).FullName!; // Act - var result = TypeLoader.LoadStaticInstanceByFullName(fullName, counter); - TypeLoader.LoadStaticInstanceByFullName(fullName, counter); + var result = TypeLoader.TryLoadStaticInstanceByFullName(out var staticInstance, fullName, counter); + TypeLoader.TryLoadStaticInstanceByFullName(out staticInstance, fullName, counter); // Assert - result.Should().BeOfType(); + result.Should().BeTrue(); + staticInstance.Should().BeOfType(); counter.Value.Should().Be(1); } [Fact] - public void LoadNewInstance_ButNoImplementationFoundForInterface_ThrowsException() + public void TryLoadNewInstance_ButNoImplementationFoundForInterface_ReturnsFalse() { // Act - Action a = () => TypeLoader.LoadNewInstance(); + var result = TypeLoader.TryLoadNewInstance(out _); // Assert - a.Should().Throw().WithMessage("No dll found which implements Interface 'WireMock.Net.Tests.Util.TypeLoaderTests+IDummyInterfaceNoImplementation'."); + result.Should().BeFalse(); } [Fact] - public void LoadNewInstanceByFullName_ButNoImplementationFoundForInterface_ThrowsException() + public void TryLoadNewInstanceByFullName_ButNoImplementationFoundForInterface_ReturnsFalse() { // Act - Action a = () => TypeLoader.LoadNewInstanceByFullName("xyz"); + var result = TypeLoader.TryLoadNewInstanceByFullName(out _, "xyz"); // Assert - a.Should().Throw().WithMessage("No dll found which implements Interface 'WireMock.Net.Tests.Util.TypeLoaderTests+IDummyInterfaceWithImplementation' and has FullName 'xyz'."); + result.Should().BeFalse(); } } \ No newline at end of file diff --git a/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj b/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj index 56aae5e5..aa08bc3a 100644 --- a/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj +++ b/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj @@ -64,7 +64,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -76,7 +76,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive