mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-05-11 09:29:42 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bfb97b192 |
25
CHANGELOG.md
25
CHANGELOG.md
@@ -1,28 +1,3 @@
|
|||||||
# 1.3.6 (10 November 2020)
|
|
||||||
- [#529](https://github.com/WireMock-Net/WireMock.Net/pull/529) - Add assertions for ClientIP, Url and ProxyUrl [feature] contributed by [akamud](https://github.com/akamud)
|
|
||||||
- [#535](https://github.com/WireMock-Net/WireMock.Net/pull/535) - WithCallback should use also use enum HttpStatusCode [bug] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#537](https://github.com/WireMock-Net/WireMock.Net/pull/537) - Add Custom Certificate settings [feature] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#533](https://github.com/WireMock-Net/WireMock.Net/issues/533) - Stubbed response with only callback returns unexpected status code. [bug]
|
|
||||||
- [#536](https://github.com/WireMock-Net/WireMock.Net/issues/536) - Overriding the default ssl certificate via file. [feature]
|
|
||||||
|
|
||||||
# 1.3.5 (04 November 2020)
|
|
||||||
- [#530](https://github.com/WireMock-Net/WireMock.Net/pull/530) - Fix dotnet-sonarscanner [bug] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#531](https://github.com/WireMock-Net/WireMock.Net/pull/531) - Add WithCallback-Async [feature] contributed by [StefH](https://github.com/StefH)
|
|
||||||
|
|
||||||
# 1.3.4 (17 October 2020)
|
|
||||||
- [#522](https://github.com/WireMock-Net/WireMock.Net/pull/522) - Add ContinuousIntegrationBuild property [feature] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#525](https://github.com/WireMock-Net/WireMock.Net/pull/525) - Handlebars.Net.Helpers Version="1.1.0" [feature] contributed by [StefH](https://github.com/StefH)
|
|
||||||
|
|
||||||
# 1.3.3 (15 October 2020)
|
|
||||||
- [#520](https://github.com/WireMock-Net/WireMock.Net/pull/520) - Make kestrel limits configurable contributed by [eduherminio](https://github.com/eduherminio)
|
|
||||||
- [#521](https://github.com/WireMock-Net/WireMock.Net/issues/521) - Make Kestrel limits configurable [feature]
|
|
||||||
|
|
||||||
# 1.3.2 (14 October 2020)
|
|
||||||
- [#505](https://github.com/WireMock-Net/WireMock.Net/pull/505) - Fix reading JsonMatcher-mapping with object as pattern [bug] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#514](https://github.com/WireMock-Net/WireMock.Net/pull/514) - Update .NET Core 3.1 example contributed by [Crossbow78](https://github.com/Crossbow78)
|
|
||||||
- [#504](https://github.com/WireMock-Net/WireMock.Net/issues/504) - Loading mapping models with `JsonMatcher` is not working correctly [bug]
|
|
||||||
- [#513](https://github.com/WireMock-Net/WireMock.Net/issues/513) - Static mapping break from 1.2.17 to 1.2.18 and higher [bug]
|
|
||||||
|
|
||||||
# 1.3.1 (30 September 2020)
|
# 1.3.1 (30 September 2020)
|
||||||
- [#509](https://github.com/WireMock-Net/WireMock.Net/pull/509) - Adding netcoreapp3.1 as a target framework [feature] contributed by [APIWT](https://github.com/APIWT)
|
- [#509](https://github.com/WireMock-Net/WireMock.Net/pull/509) - Adding netcoreapp3.1 as a target framework [feature] contributed by [APIWT](https://github.com/APIWT)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>1.3.6</VersionPrefix>
|
<VersionPrefix>1.3.1</VersionPrefix>
|
||||||
<PackageReleaseNotes>See CHANGELOG.md</PackageReleaseNotes>
|
<PackageReleaseNotes>See CHANGELOG.md</PackageReleaseNotes>
|
||||||
<PackageIconUrl>https://raw.githubusercontent.com/WireMock-Net/WireMock.Net/master/WireMock.Net-Logo.png</PackageIconUrl>
|
<PackageIconUrl>https://raw.githubusercontent.com/WireMock-Net/WireMock.Net/master/WireMock.Net-Logo.png</PackageIconUrl>
|
||||||
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
||||||
@@ -14,10 +14,6 @@
|
|||||||
<ApplicationIcon>../../WireMock.Net-Logo.ico</ApplicationIcon>
|
<ApplicationIcon>../../WireMock.Net-Logo.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
|
|
||||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<Choose>
|
<Choose>
|
||||||
<!-- The environment variable `Prerelease` is set in the azure-pipelines.yml file. -->
|
<!-- The environment variable `Prerelease` is set in the azure-pipelines.yml file. -->
|
||||||
<When Condition=" '$(Prerelease)' != '' ">
|
<When Condition=" '$(Prerelease)' != '' ">
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
https://github.com/StefH/GitHubReleaseNotes
|
https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.3.6
|
GitHubReleaseNotes.exe --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc --version 1.3.1
|
||||||
@@ -71,8 +71,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.WebApplication
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.WebApplication.NETCore3", "examples\WireMock.Net.WebApplication.NETCore3\WireMock.Net.WebApplication.NETCore3.csproj", "{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.WebApplication.NETCore3", "examples\WireMock.Net.WebApplication.NETCore3\WireMock.Net.WebApplication.NETCore3.csproj", "{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.NETCoreApp3WithCertificate", "examples\WireMock.Net.Console.NETCoreApp3WithCertificate\WireMock.Net.Console.NETCoreApp3WithCertificate.csproj", "{925E421A-1B3F-4202-B48F-734743573A4B}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -175,10 +173,6 @@ Global
|
|||||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{925E421A-1B3F-4202-B48F-734743573A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{925E421A-1B3F-4202-B48F-734743573A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{925E421A-1B3F-4202-B48F-734743573A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{925E421A-1B3F-4202-B48F-734743573A4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -208,7 +202,6 @@ Global
|
|||||||
{B6269AAC-170A-4346-8B9A-579DED3D9A95} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{B6269AAC-170A-4346-8B9A-579DED3D9A95} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
{6F38CB3A-6DA1-408A-AECD-E434523C2838} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
{6F38CB3A-6DA1-408A-AECD-E434523C2838} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
{E1C56967-3DC7-46CB-A1DF-B13167A0D9D4} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
{925E421A-1B3F-4202-B48F-734743573A4B} = {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}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
<PackageReference Include="Handlebars.Net.Helpers" Version="1.1.0" />
|
<PackageReference Include="Handlebars.Net.Helpers" Version="1.0.0" />
|
||||||
<PackageReference Include="log4net" Version="2.0.8" />
|
<PackageReference Include="log4net" Version="2.0.8" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<!--<PackageReference Include="Microsoft.CodeAnalysis.Scripting.Common" Version="3.4.0" />-->
|
<!--<PackageReference Include="Microsoft.CodeAnalysis.Scripting.Common" Version="3.4.0" />-->
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
using WireMock.Logging;
|
|
||||||
using WireMock.Server;
|
|
||||||
using WireMock.Settings;
|
|
||||||
|
|
||||||
namespace WireMock.Net.Console.NETCoreApp3WithCertificate
|
|
||||||
{
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
string url = "https://localhost:8433/";
|
|
||||||
|
|
||||||
var server = WireMockServer.Start(new WireMockServerSettings
|
|
||||||
{
|
|
||||||
Urls = new[] { url },
|
|
||||||
StartAdminInterface = true,
|
|
||||||
Logger = new WireMockConsoleLogger(),
|
|
||||||
CertificateSettings = new WireMockCertificateSettings
|
|
||||||
{
|
|
||||||
X509StoreName = "My",
|
|
||||||
X509StoreLocation = "CurrentUser",
|
|
||||||
X509StoreThumbprintOrSubjectName = "FE16586076A8B3F3E2F1466803A6C4C7CA35455B"
|
|
||||||
|
|
||||||
// X509CertificateFilePath = "example.pfx",
|
|
||||||
// X509CertificatePassword = "wiremock"
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
System.Console.WriteLine("WireMockServer listening at {0}", string.Join(",", server.Urls));
|
|
||||||
|
|
||||||
System.Console.WriteLine("Press any key to stop the server");
|
|
||||||
System.Console.ReadKey();
|
|
||||||
server.Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net.StandAlone\WireMock.Net.StandAlone.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="example.pfx">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIIEsDCCApigAwIBAgIQJbH6hSGKdoFI0B7qCIOK7jANBgkqhkiG9w0BAQUFADAU
|
|
||||||
MRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMjAxMDMwMjMwMDAwWhcNMzAxMTA2MjMw
|
|
||||||
MDAwWjAUMRIwEAYDVQQDEwlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4IC
|
|
||||||
DwAwggIKAoICAQCl5fQSrRgT3Q6WoULR98Y+rrDWtTTgVpbLU04G0hLZ4yUeP7Wa
|
|
||||||
yuVbvx7zX8XT4lA8Hu5T/GG91U077JcSSEjnPBFsh4hE7FkRoSYIEW6BFG7D7eUG
|
|
||||||
dGHnDV8UkSRQ97LJPyjXuHVDJzNDJ9xQGMzOZ4n8vQ7SEKBw9hRG2ugkP5b2jVIN
|
|
||||||
e1E549tq2jnIVpKCZ4+prf64ZLsaokX7VHe+b/CW3GoAqUUaUjdTpAQ7LpypJuFz
|
|
||||||
415enOrKQe+UEBdqhGlgcC/O/Bw0uq4qVk+NNe5DEINVwoYs9XjNdzxuIkkAtcCt
|
|
||||||
avTEzhHf8zWYLb5Nt2DIOcRGVELvRhsBX4um5f7dOGzMbXzBfUdjkP2O4hi6crhm
|
|
||||||
Hba5bNkj4Zw2EHR9Xua3nadGCj22z0vpMKP2gXdFVnxFqQlaUWBLtwwN9p6tCQHl
|
|
||||||
kU7wypvOHUsMa2Ojg5eZP4RpYFvZG3kkc9zTZCSakgw2n0ampBbvxPP11/AYIXtz
|
|
||||||
HKu3CKcpjVQ+lE0DAU/Mm77QJ24TMbXmAydwCf1UCdFbDUZhdM9lspHvA0J9eiCv
|
|
||||||
LOE94BrpVKuZ6TrAW0LZjAmBnkqYQAewhTW7GSgARE+QQcwfyu03Ck7id3Zt4FeQ
|
|
||||||
sQDo0NNj7zQOy3Y1GK0ZYAVZv/GUeHMkxpClSWPoub/f5SJ4YzD5Il0cQQIDAQAB
|
|
||||||
MA0GCSqGSIb3DQEBBQUAA4ICAQBd91xfUepnWcKwmupie2h1CAAQZEunyW78i++t
|
|
||||||
evABfBu0TgV4s6Xe0umFv9V4r+O+rrF3ddSudbSOPBEb0Ooe+e3YGlNk1JrI1EEn
|
|
||||||
fhb0YI8bMfBNpl85yNqxgByra7JF2mG4qbAnjrCs/PZkXo/34N29SY6dyZ7mffR3
|
|
||||||
r/l01Rdm3ogRwGkiMUeKb3iGwLUy1T55svuI3Zc13N+NJT1s9NqpwWeK/jFK/WRN
|
|
||||||
5Hi9W3DmlGCYAwFPCyBaQagxpGuGIpNsU0hKp86W5EvJpBpmCihfwlydH8ZbkHJ9
|
|
||||||
jx2UDgTCaDzmaiKysiTP2HHDBsReL4tjakBksa9jkTfy5ajB53F3aUVs4jvTA46L
|
|
||||||
w8wcAJlRPBz5siBrv4CH/0lBMyNeYzuqmDY3ulF4IMKNb5Kk9Ye4Pt0474z50A4v
|
|
||||||
fSah+9iwI/mubaJ5tK522AtWtUoOIAswIwpDQyNeJPOggyzT2Y2OYZdGuFAoMYuq
|
|
||||||
ZD58k4Yo+vky9K88l8NuzNJJvtgTKtT+/9qfMucxFmnvwbKEEULP3sw1FUKkPtM4
|
|
||||||
f242FIV/XnOeloDmhGGeTB7aODB+gGCvgmOH92njjUEIv+SnYQkflQaRhhyNIACi
|
|
||||||
ZvWlP/96H+X4fUG5kVNBHY021ZWmurUDqVxWUaswg63+DfsZcYtt6wgxiAN4ssXG
|
|
||||||
wLnLPw==
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -12,7 +12,6 @@ using WireMock.ResponseBuilders;
|
|||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
using WireMock.Util;
|
using WireMock.Util;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WireMock.Net.ConsoleApplication
|
namespace WireMock.Net.ConsoleApplication
|
||||||
{
|
{
|
||||||
@@ -250,13 +249,6 @@ namespace WireMock.Net.ConsoleApplication
|
|||||||
.WithProxy("http://www.google.com")
|
.WithProxy("http://www.google.com")
|
||||||
);
|
);
|
||||||
|
|
||||||
server
|
|
||||||
.Given(Request.Create().WithHeader("ProxyThisHttps", "true")
|
|
||||||
.UsingGet())
|
|
||||||
.RespondWith(Response.Create()
|
|
||||||
.WithProxy("https://www.google.com")
|
|
||||||
);
|
|
||||||
|
|
||||||
server
|
server
|
||||||
.Given(Request.Create().WithPath("/bodyasbytes.png")
|
.Given(Request.Create().WithPath("/bodyasbytes.png")
|
||||||
.UsingGet())
|
.UsingGet())
|
||||||
@@ -529,29 +521,9 @@ namespace WireMock.Net.ConsoleApplication
|
|||||||
.WithBodyAsJson(new { Id = "5bdf076c-5654-4b3e-842c-7caf1fabf8c9" }));
|
.WithBodyAsJson(new { Id = "5bdf076c-5654-4b3e-842c-7caf1fabf8c9" }));
|
||||||
server
|
server
|
||||||
.Given(Request.Create().WithPath("/random200or505").UsingGet())
|
.Given(Request.Create().WithPath("/random200or505").UsingGet())
|
||||||
.RespondWith(Response.Create().WithCallback(request =>
|
.RespondWith(Response.Create().WithCallback(request => new ResponseMessage
|
||||||
{
|
{
|
||||||
int code = new Random().Next(1, 2) == 1 ? 505 : 200;
|
StatusCode = new Random().Next(1, 100) == 1 ? 504 : 200
|
||||||
return new ResponseMessage
|
|
||||||
{
|
|
||||||
BodyData = new BodyData { BodyAsString = "random200or505:" + code, DetectedBodyType = Types.BodyType.String },
|
|
||||||
StatusCode = code
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
|
|
||||||
server
|
|
||||||
.Given(Request.Create().WithPath("/random200or505async").UsingGet())
|
|
||||||
.RespondWith(Response.Create().WithCallback(async request =>
|
|
||||||
{
|
|
||||||
await Task.Delay(1);
|
|
||||||
|
|
||||||
int code = new Random().Next(1, 2) == 1 ? 505 : 200;
|
|
||||||
|
|
||||||
return new ResponseMessage
|
|
||||||
{
|
|
||||||
BodyData = new BodyData { BodyAsString = "random200or505async:" + code, DetectedBodyType = Types.BodyType.String },
|
|
||||||
StatusCode = code
|
|
||||||
};
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
System.Console.WriteLine(JsonConvert.SerializeObject(server.MappingModels, Formatting.Indented));
|
System.Console.WriteLine(JsonConvert.SerializeObject(server.MappingModels, Formatting.Indented));
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ namespace WireMock.Server
|
|||||||
void AddGlobalProcessingDelay(TimeSpan delay);
|
void AddGlobalProcessingDelay(TimeSpan delay);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allows the partial mapping.
|
/// Set the partial mapping to allowed (if true, you can also provide 'enforceHttpMethod').
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void AllowPartialMapping(bool allow = true);
|
void AllowPartialMapping(bool allow = true, bool enforceHttpMethod = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a LogEntry.
|
/// Deletes a LogEntry.
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ namespace WireMock.FluentAssertions
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> AtAbsoluteUrl(string absoluteUrl, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> AtAbsoluteUrl(string absoluteUrl, string because = "",
|
||||||
|
params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
Execute.Assertion
|
Execute.Assertion
|
||||||
.BecauseOf(because, becauseArgs)
|
.BecauseOf(because, becauseArgs)
|
||||||
@@ -35,11 +36,13 @@ namespace WireMock.FluentAssertions
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string value, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string value,
|
||||||
|
string because = "", params object[] becauseArgs)
|
||||||
=> WithHeader(expectedKey, new[] {value}, because, becauseArgs);
|
=> WithHeader(expectedKey, new[] {value}, because, becauseArgs);
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues,
|
||||||
|
string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
var headersDictionary = _subject.LogEntries.SelectMany(x => x.RequestMessage.Headers)
|
var headersDictionary = _subject.LogEntries.SelectMany(x => x.RequestMessage.Headers)
|
||||||
.ToDictionary(x => x.Key, x => x.Value);
|
.ToDictionary(x => x.Key, x => x.Value);
|
||||||
@@ -69,62 +72,5 @@ namespace WireMock.FluentAssertions
|
|||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
return new AndConstraint<WireMockAssertions>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
|
||||||
public AndConstraint<WireMockAssertions> AtUrl(string url, string because = "", params object[] becauseArgs)
|
|
||||||
{
|
|
||||||
Execute.Assertion
|
|
||||||
.BecauseOf(because, becauseArgs)
|
|
||||||
.Given(() => _subject.LogEntries.Select(x => x.RequestMessage).ToList())
|
|
||||||
.ForCondition(requests => requests.Any())
|
|
||||||
.FailWith(
|
|
||||||
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but no calls were made.",
|
|
||||||
url)
|
|
||||||
.Then
|
|
||||||
.ForCondition(x => x.Any(y => y.Url == url))
|
|
||||||
.FailWith(
|
|
||||||
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but didn't find it among the calls to {1}.",
|
|
||||||
_ => url, requests => requests.Select(request => request.Url));
|
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
[CustomAssertion]
|
|
||||||
public AndConstraint<WireMockAssertions> WithProxyUrl(string proxyUrl, string because = "", params object[] becauseArgs)
|
|
||||||
{
|
|
||||||
Execute.Assertion
|
|
||||||
.BecauseOf(because, becauseArgs)
|
|
||||||
.Given(() => _subject.LogEntries.Select(x => x.RequestMessage).ToList())
|
|
||||||
.ForCondition(requests => requests.Any())
|
|
||||||
.FailWith(
|
|
||||||
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but no calls were made.",
|
|
||||||
proxyUrl)
|
|
||||||
.Then
|
|
||||||
.ForCondition(x => x.Any(y => y.ProxyUrl == proxyUrl))
|
|
||||||
.FailWith(
|
|
||||||
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but didn't find it among the calls with {1}.",
|
|
||||||
_ => proxyUrl, requests => requests.Select(request => request.ProxyUrl));
|
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
[CustomAssertion]
|
|
||||||
public AndConstraint<WireMockAssertions> FromClientIP(string clientIP, string because = "", params object[] becauseArgs)
|
|
||||||
{
|
|
||||||
Execute.Assertion
|
|
||||||
.BecauseOf(because, becauseArgs)
|
|
||||||
.Given(() => _subject.LogEntries.Select(x => x.RequestMessage).ToList())
|
|
||||||
.ForCondition(requests => requests.Any())
|
|
||||||
.FailWith(
|
|
||||||
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but no calls were made.",
|
|
||||||
clientIP)
|
|
||||||
.Then
|
|
||||||
.ForCondition(x => x.Any(y => y.ClientIP == clientIP))
|
|
||||||
.FailWith(
|
|
||||||
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but didn't find it among the calls from IP(s) {1}.",
|
|
||||||
_ => clientIP, requests => requests.Select(request => request.ClientIP));
|
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace WireMock.Http
|
|||||||
{
|
{
|
||||||
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
|
||||||
|
|
||||||
var x509Certificate2 = CertificateLoader.LoadCertificate(settings.ClientX509Certificate2ThumbprintOrSubjectName);
|
var x509Certificate2 = ClientCertificateHelper.GetCertificate(settings.ClientX509Certificate2ThumbprintOrSubjectName);
|
||||||
handler.ClientCertificates.Add(x509Certificate2);
|
handler.ClientCertificates.Add(x509Certificate2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
|
|
||||||
namespace WireMock.HttpsCertificate
|
|
||||||
{
|
|
||||||
internal static class CertificateLoader
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Used by the WireMock.Net server
|
|
||||||
/// </summary>
|
|
||||||
public static X509Certificate2 LoadCertificate(
|
|
||||||
string storeName,
|
|
||||||
string storeLocation,
|
|
||||||
string thumbprintOrSubjectName,
|
|
||||||
string filePath,
|
|
||||||
string password,
|
|
||||||
string host)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(storeName) && !string.IsNullOrEmpty(storeLocation))
|
|
||||||
{
|
|
||||||
var thumbprintOrSubjectNameOrHost = thumbprintOrSubjectName ?? host;
|
|
||||||
|
|
||||||
var certStore = new X509Store((StoreName)Enum.Parse(typeof(StoreName), storeName), (StoreLocation)Enum.Parse(typeof(StoreLocation), storeLocation));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
certStore.Open(OpenFlags.ReadOnly);
|
|
||||||
|
|
||||||
// Attempt to find by Thumbprint first
|
|
||||||
var matchingCertificates = certStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprintOrSubjectNameOrHost, false);
|
|
||||||
if (matchingCertificates.Count == 0)
|
|
||||||
{
|
|
||||||
// Fallback to SubjectName
|
|
||||||
matchingCertificates = certStore.Certificates.Find(X509FindType.FindBySubjectName, thumbprintOrSubjectNameOrHost, false);
|
|
||||||
if (matchingCertificates.Count == 0)
|
|
||||||
{
|
|
||||||
// No certificates matched the search criteria.
|
|
||||||
throw new FileNotFoundException($"No Certificate found with in store '{storeName}', location '{storeLocation}' for Thumbprint or SubjectName '{thumbprintOrSubjectNameOrHost}'.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use the first matching certificate.
|
|
||||||
return matchingCertificates[0];
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
#if NETSTANDARD || NET46
|
|
||||||
certStore.Dispose();
|
|
||||||
#else
|
|
||||||
certStore.Close();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filePath) && !string.IsNullOrEmpty(password))
|
|
||||||
{
|
|
||||||
return new X509Certificate2(filePath, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new InvalidOperationException("X509StoreName and X509StoreLocation OR X509CertificateFilePath and X509CertificatePassword are mandatory.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used for Proxy
|
|
||||||
/// </summary>
|
|
||||||
public static X509Certificate2 LoadCertificate(string thumbprintOrSubjectName)
|
|
||||||
{
|
|
||||||
var certStore = new X509Store(StoreName.My, StoreLocation.LocalMachine);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Certificate must be in the local machine store
|
|
||||||
certStore.Open(OpenFlags.ReadOnly);
|
|
||||||
|
|
||||||
// Attempt to find by Thumbprint first
|
|
||||||
var matchingCertificates = certStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprintOrSubjectName, false);
|
|
||||||
if (matchingCertificates.Count == 0)
|
|
||||||
{
|
|
||||||
// Fallback to SubjectName
|
|
||||||
matchingCertificates = certStore.Certificates.Find(X509FindType.FindBySubjectName, thumbprintOrSubjectName, false);
|
|
||||||
if (matchingCertificates.Count == 0)
|
|
||||||
{
|
|
||||||
// No certificates matched the search criteria.
|
|
||||||
throw new FileNotFoundException("No certificate found with specified Thumbprint or SubjectName.", thumbprintOrSubjectName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use the first matching certificate.
|
|
||||||
return matchingCertificates[0];
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
#if NETSTANDARD || NET46
|
|
||||||
certStore.Dispose();
|
|
||||||
#else
|
|
||||||
certStore.Close();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
42
src/WireMock.Net/HttpsCertificate/ClientCertificateHelper.cs
Normal file
42
src/WireMock.Net/HttpsCertificate/ClientCertificateHelper.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
|
namespace WireMock.HttpsCertificate
|
||||||
|
{
|
||||||
|
internal static class ClientCertificateHelper
|
||||||
|
{
|
||||||
|
public static X509Certificate2 GetCertificate(string thumbprintOrSubjectName)
|
||||||
|
{
|
||||||
|
X509Store certStore = new X509Store(StoreName.My, StoreLocation.LocalMachine);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Certificate must be in the local machine store
|
||||||
|
certStore.Open(OpenFlags.ReadOnly);
|
||||||
|
|
||||||
|
// Attempt to find by thumbprint first
|
||||||
|
var matchingCertificates = certStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprintOrSubjectName, false);
|
||||||
|
if (matchingCertificates.Count == 0)
|
||||||
|
{
|
||||||
|
// Fallback to subject name
|
||||||
|
matchingCertificates = certStore.Certificates.Find(X509FindType.FindBySubjectName, thumbprintOrSubjectName, false);
|
||||||
|
if (matchingCertificates.Count == 0)
|
||||||
|
{
|
||||||
|
// No certificates matched the search criteria.
|
||||||
|
throw new FileNotFoundException("No certificate found with specified Thumbprint or SubjectName.", thumbprintOrSubjectName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use the first matching certificate.
|
||||||
|
return matchingCertificates[0];
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
#if NETSTANDARD || NET46
|
||||||
|
certStore.Dispose();
|
||||||
|
#else
|
||||||
|
certStore.Close();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
#if USE_ASPNETCORE && !NETSTANDARD1_3
|
#if USE_ASPNETCORE && !NETSTANDARD1_3
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using WireMock.HttpsCertificate;
|
|
||||||
|
|
||||||
namespace WireMock.Owin
|
namespace WireMock.Owin
|
||||||
{
|
{
|
||||||
@@ -18,56 +16,23 @@ namespace WireMock.Owin
|
|||||||
options.Limits.MaxResponseBufferSize = null;
|
options.Limits.MaxResponseBufferSize = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetHttpsAndUrls(KestrelServerOptions kestrelOptions, IWireMockMiddlewareOptions wireMockMiddlewareOptions, IEnumerable<HostUrlDetails> urlDetails)
|
private static void SetHttpsAndUrls(KestrelServerOptions options, ICollection<(string Url, int Port)> urlDetails)
|
||||||
{
|
{
|
||||||
foreach (var urlDetail in urlDetails)
|
foreach (var detail in urlDetails)
|
||||||
{
|
{
|
||||||
if (urlDetail.IsHttps)
|
if (detail.Url.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
kestrelOptions.Listen(System.Net.IPAddress.Any, urlDetail.Port, listenOptions =>
|
options.Listen(System.Net.IPAddress.Any, detail.Port, listenOptions =>
|
||||||
{
|
|
||||||
if (wireMockMiddlewareOptions.CustomCertificateDefined)
|
|
||||||
{
|
|
||||||
listenOptions.UseHttps(CertificateLoader.LoadCertificate(
|
|
||||||
wireMockMiddlewareOptions.X509StoreName,
|
|
||||||
wireMockMiddlewareOptions.X509StoreLocation,
|
|
||||||
wireMockMiddlewareOptions.X509ThumbprintOrSubjectName,
|
|
||||||
wireMockMiddlewareOptions.X509CertificateFilePath,
|
|
||||||
wireMockMiddlewareOptions.X509CertificatePassword,
|
|
||||||
urlDetail.Host)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
listenOptions.UseHttps();
|
listenOptions.UseHttps();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kestrelOptions.Listen(System.Net.IPAddress.Any, urlDetail.Port);
|
options.Listen(System.Net.IPAddress.Any, detail.Port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static class IWebHostBuilderExtensions
|
|
||||||
{
|
|
||||||
internal static IWebHostBuilder ConfigureAppConfigurationUsingEnvironmentVariables(this IWebHostBuilder builder)
|
|
||||||
{
|
|
||||||
return builder.ConfigureAppConfiguration(config =>
|
|
||||||
{
|
|
||||||
config.AddEnvironmentVariables();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static IWebHostBuilder ConfigureKestrelServerOptions(this IWebHostBuilder builder)
|
|
||||||
{
|
|
||||||
return builder.ConfigureServices((context, services) =>
|
|
||||||
{
|
|
||||||
services.Configure<KestrelServerOptions>(context.Configuration.GetSection("Kestrel"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
#if USE_ASPNETCORE && NETSTANDARD1_3
|
#if USE_ASPNETCORE && NETSTANDARD1_3
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel;
|
using Microsoft.AspNetCore.Server.Kestrel;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using WireMock.HttpsCertificate;
|
using WireMock.HttpsCertificate;
|
||||||
|
|
||||||
namespace WireMock.Owin
|
namespace WireMock.Owin
|
||||||
@@ -17,47 +17,14 @@ namespace WireMock.Owin
|
|||||||
options.Limits.MaxResponseBufferSize = null;
|
options.Limits.MaxResponseBufferSize = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetHttpsAndUrls(KestrelServerOptions options, IWireMockMiddlewareOptions wireMockMiddlewareOptions, IEnumerable<HostUrlDetails> urlDetails)
|
private static void SetHttpsAndUrls(KestrelServerOptions options, ICollection<(string Url, int Port)> urlDetails)
|
||||||
{
|
{
|
||||||
foreach (var urlDetail in urlDetails)
|
var urls = urlDetails.Select(u => u.Url);
|
||||||
{
|
if (urls.Any(u => u.StartsWith("https://", StringComparison.OrdinalIgnoreCase)))
|
||||||
if (urlDetail.IsHttps)
|
|
||||||
{
|
|
||||||
if (wireMockMiddlewareOptions.CustomCertificateDefined)
|
|
||||||
{
|
|
||||||
options.UseHttps(CertificateLoader.LoadCertificate(
|
|
||||||
wireMockMiddlewareOptions.X509StoreName,
|
|
||||||
wireMockMiddlewareOptions.X509StoreLocation,
|
|
||||||
wireMockMiddlewareOptions.X509ThumbprintOrSubjectName,
|
|
||||||
wireMockMiddlewareOptions.X509CertificateFilePath,
|
|
||||||
wireMockMiddlewareOptions.X509CertificatePassword,
|
|
||||||
urlDetail.Host)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
options.UseHttps(PublicCertificateHelper.GetX509Certificate2());
|
options.UseHttps(PublicCertificateHelper.GetX509Certificate2());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static class IWebHostBuilderExtensions
|
|
||||||
{
|
|
||||||
internal static IWebHostBuilder ConfigureAppConfigurationUsingEnvironmentVariables(this IWebHostBuilder builder) => builder;
|
|
||||||
|
|
||||||
internal static IWebHostBuilder ConfigureKestrelServerOptions(this IWebHostBuilder builder)
|
|
||||||
{
|
|
||||||
var configuration = new ConfigurationBuilder()
|
|
||||||
.AddEnvironmentVariables()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
return builder.ConfigureServices(services =>
|
|
||||||
{
|
|
||||||
services.Configure<KestrelServerOptions>(configuration.GetSection("Kestrel"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -18,7 +18,7 @@ namespace WireMock.Owin
|
|||||||
internal partial class AspNetCoreSelfHost : IOwinSelfHost
|
internal partial class AspNetCoreSelfHost : IOwinSelfHost
|
||||||
{
|
{
|
||||||
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
|
private readonly CancellationTokenSource _cts = new CancellationTokenSource();
|
||||||
private readonly IWireMockMiddlewareOptions _wireMockMiddlewareOptions;
|
private readonly IWireMockMiddlewareOptions _options;
|
||||||
private readonly IWireMockLogger _logger;
|
private readonly IWireMockLogger _logger;
|
||||||
private readonly HostUrlOptions _urlOptions;
|
private readonly HostUrlOptions _urlOptions;
|
||||||
|
|
||||||
@@ -33,14 +33,14 @@ namespace WireMock.Owin
|
|||||||
|
|
||||||
public Exception RunningException => _runningException;
|
public Exception RunningException => _runningException;
|
||||||
|
|
||||||
public AspNetCoreSelfHost([NotNull] IWireMockMiddlewareOptions wireMockMiddlewareOptions, [NotNull] HostUrlOptions urlOptions)
|
public AspNetCoreSelfHost([NotNull] IWireMockMiddlewareOptions options, [NotNull] HostUrlOptions urlOptions)
|
||||||
{
|
{
|
||||||
Check.NotNull(wireMockMiddlewareOptions, nameof(wireMockMiddlewareOptions));
|
Check.NotNull(options, nameof(options));
|
||||||
Check.NotNull(urlOptions, nameof(urlOptions));
|
Check.NotNull(urlOptions, nameof(urlOptions));
|
||||||
|
|
||||||
_logger = wireMockMiddlewareOptions.Logger ?? new WireMockConsoleLogger();
|
_logger = options.Logger ?? new WireMockConsoleLogger();
|
||||||
|
|
||||||
_wireMockMiddlewareOptions = wireMockMiddlewareOptions;
|
_options = options;
|
||||||
_urlOptions = urlOptions;
|
_urlOptions = urlOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,10 +58,9 @@ namespace WireMock.Owin
|
|||||||
}
|
}
|
||||||
|
|
||||||
_host = builder
|
_host = builder
|
||||||
.ConfigureAppConfigurationUsingEnvironmentVariables()
|
|
||||||
.ConfigureServices(services =>
|
.ConfigureServices(services =>
|
||||||
{
|
{
|
||||||
services.AddSingleton(_wireMockMiddlewareOptions);
|
services.AddSingleton(_options);
|
||||||
services.AddSingleton<IMappingMatcher, MappingMatcher>();
|
services.AddSingleton<IMappingMatcher, MappingMatcher>();
|
||||||
services.AddSingleton<IOwinRequestMapper, OwinRequestMapper>();
|
services.AddSingleton<IOwinRequestMapper, OwinRequestMapper>();
|
||||||
services.AddSingleton<IOwinResponseMapper, OwinResponseMapper>();
|
services.AddSingleton<IOwinResponseMapper, OwinResponseMapper>();
|
||||||
@@ -70,19 +69,18 @@ namespace WireMock.Owin
|
|||||||
{
|
{
|
||||||
appBuilder.UseMiddleware<GlobalExceptionMiddleware>();
|
appBuilder.UseMiddleware<GlobalExceptionMiddleware>();
|
||||||
|
|
||||||
_wireMockMiddlewareOptions.PreWireMockMiddlewareInit?.Invoke(appBuilder);
|
_options.PreWireMockMiddlewareInit?.Invoke(appBuilder);
|
||||||
|
|
||||||
appBuilder.UseMiddleware<WireMockMiddleware>();
|
appBuilder.UseMiddleware<WireMockMiddleware>();
|
||||||
|
|
||||||
_wireMockMiddlewareOptions.PostWireMockMiddlewareInit?.Invoke(appBuilder);
|
_options.PostWireMockMiddlewareInit?.Invoke(appBuilder);
|
||||||
})
|
})
|
||||||
.UseKestrel(options =>
|
.UseKestrel(options =>
|
||||||
{
|
{
|
||||||
SetKestrelOptionsLimits(options);
|
SetKestrelOptionsLimits(options);
|
||||||
|
|
||||||
SetHttpsAndUrls(options, _wireMockMiddlewareOptions, _urlOptions.GetDetails());
|
SetHttpsAndUrls(options, _urlOptions.GetDetails());
|
||||||
})
|
})
|
||||||
.ConfigureKestrelServerOptions()
|
|
||||||
|
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
.UseUrls(_urlOptions.GetDetails().Select(u => u.Url).ToArray())
|
.UseUrls(_urlOptions.GetDetails().Select(u => u.Url).ToArray())
|
||||||
@@ -107,7 +105,7 @@ namespace WireMock.Owin
|
|||||||
{
|
{
|
||||||
Urls.Add(address.Replace("0.0.0.0", "localhost"));
|
Urls.Add(address.Replace("0.0.0.0", "localhost"));
|
||||||
|
|
||||||
PortUtils.TryExtract(address, out bool isHttps, out string protocol, out string host, out int port);
|
PortUtils.TryExtract(address, out string protocol, out string host, out int port);
|
||||||
Ports.Add(port);
|
Ports.Add(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,10 +118,8 @@ namespace WireMock.Owin
|
|||||||
_logger.Info("WireMock.Net server using netstandard2.0");
|
_logger.Info("WireMock.Net server using netstandard2.0");
|
||||||
#elif NETSTANDARD2_1
|
#elif NETSTANDARD2_1
|
||||||
_logger.Info("WireMock.Net server using netstandard2.1");
|
_logger.Info("WireMock.Net server using netstandard2.1");
|
||||||
#elif NETCOREAPP3_1
|
|
||||||
_logger.Info("WireMock.Net server using .NET Core 3.1");
|
|
||||||
#elif NET46
|
#elif NET46
|
||||||
_logger.Info("WireMock.Net server using .NET Framework 4.6.1 or higher");
|
_logger.Info("WireMock.Net server using .net 4.6.1 or higher");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
namespace WireMock.Owin
|
|
||||||
{
|
|
||||||
internal class HostUrlDetails
|
|
||||||
{
|
|
||||||
public bool IsHttps { get; set; }
|
|
||||||
|
|
||||||
public string Url { get; set; }
|
|
||||||
|
|
||||||
public string Protocol { get; set; }
|
|
||||||
|
|
||||||
public string Host { get; set; }
|
|
||||||
|
|
||||||
public int Port { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,29 +5,26 @@ namespace WireMock.Owin
|
|||||||
{
|
{
|
||||||
internal class HostUrlOptions
|
internal class HostUrlOptions
|
||||||
{
|
{
|
||||||
private const string LOCALHOST = "localhost";
|
|
||||||
|
|
||||||
public ICollection<string> Urls { get; set; }
|
public ICollection<string> Urls { get; set; }
|
||||||
|
|
||||||
public int? Port { get; set; }
|
public int? Port { get; set; }
|
||||||
|
|
||||||
public bool UseSSL { get; set; }
|
public bool UseSSL { get; set; }
|
||||||
|
|
||||||
public ICollection<HostUrlDetails> GetDetails()
|
public ICollection<(string Url, int Port)> GetDetails()
|
||||||
{
|
{
|
||||||
var list = new List<HostUrlDetails>();
|
var list = new List<(string Url, int Port)>();
|
||||||
if (Urls == null)
|
if (Urls == null)
|
||||||
{
|
{
|
||||||
int port = Port > 0 ? Port.Value : FindFreeTcpPort();
|
int port = Port > 0 ? Port.Value : FindFreeTcpPort();
|
||||||
string protocol = UseSSL ? "https" : "http";
|
list.Add(($"{(UseSSL ? "https" : "http")}://localhost:{port}", port));
|
||||||
list.Add(new HostUrlDetails { IsHttps = UseSSL, Url = $"{protocol}://{LOCALHOST}:{port}", Protocol = protocol, Host = LOCALHOST, Port = port });
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (string url in Urls)
|
foreach (string url in Urls)
|
||||||
{
|
{
|
||||||
PortUtils.TryExtract(url, out bool isHttps, out string protocol, out string host, out int port);
|
PortUtils.TryExtract(url, out string protocol, out string host, out int port);
|
||||||
list.Add(new HostUrlDetails { IsHttps = isHttps, Url = url, Protocol = protocol, Host = host, Port = port });
|
list.Add((url, port));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using WireMock.Handlers;
|
|||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
using WireMock.Matchers;
|
using WireMock.Matchers;
|
||||||
using WireMock.Util;
|
using WireMock.Util;
|
||||||
|
using WireMock.Settings;
|
||||||
#if !USE_ASPNETCORE
|
#if !USE_ASPNETCORE
|
||||||
using Owin;
|
using Owin;
|
||||||
#else
|
#else
|
||||||
@@ -22,6 +23,8 @@ namespace WireMock.Owin
|
|||||||
|
|
||||||
bool? AllowPartialMapping { get; set; }
|
bool? AllowPartialMapping { get; set; }
|
||||||
|
|
||||||
|
IPartialMappingSettings PartialMappingSettings { get; set; }
|
||||||
|
|
||||||
ConcurrentDictionary<Guid, IMapping> Mappings { get; }
|
ConcurrentDictionary<Guid, IMapping> Mappings { get; }
|
||||||
|
|
||||||
ConcurrentDictionary<string, ScenarioState> Scenarios { get; }
|
ConcurrentDictionary<string, ScenarioState> Scenarios { get; }
|
||||||
@@ -47,17 +50,5 @@ namespace WireMock.Owin
|
|||||||
bool? DisableRequestBodyDecompressing { get; set; }
|
bool? DisableRequestBodyDecompressing { get; set; }
|
||||||
|
|
||||||
bool? HandleRequestsSynchronously { get; set; }
|
bool? HandleRequestsSynchronously { get; set; }
|
||||||
|
|
||||||
string X509StoreName { get; set; }
|
|
||||||
|
|
||||||
string X509StoreLocation { get; set; }
|
|
||||||
|
|
||||||
string X509ThumbprintOrSubjectName { get; set; }
|
|
||||||
|
|
||||||
string X509CertificateFilePath { get; set; }
|
|
||||||
|
|
||||||
string X509CertificatePassword { get; set; }
|
|
||||||
|
|
||||||
bool CustomCertificateDefined { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -80,22 +79,17 @@ namespace WireMock.Owin.Mappers
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var statusCodeType = responseMessage.StatusCode?.GetType();
|
switch (responseMessage.StatusCode)
|
||||||
|
|
||||||
switch (statusCodeType)
|
|
||||||
{
|
{
|
||||||
case Type typeAsIntOrEnum when typeAsIntOrEnum == typeof(int) || typeAsIntOrEnum == typeof(int?) || typeAsIntOrEnum.GetTypeInfo().IsEnum:
|
case int statusCodeAsInteger:
|
||||||
response.StatusCode = MapStatusCode((int)responseMessage.StatusCode);
|
response.StatusCode = MapStatusCode(statusCodeAsInteger);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Type typeAsString when typeAsString == typeof(string):
|
case string statusCodeAsString:
|
||||||
// Note: this case will also match on null
|
// Note: this case will also match on null
|
||||||
int.TryParse(responseMessage.StatusCode as string, out int result);
|
int.TryParse(statusCodeAsString, out int result);
|
||||||
response.StatusCode = MapStatusCode(result);
|
response.StatusCode = MapStatusCode(result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetResponseHeaders(responseMessage, response);
|
SetResponseHeaders(responseMessage, response);
|
||||||
|
|||||||
@@ -42,6 +42,16 @@ namespace WireMock.Owin
|
|||||||
.OrderBy(m => m.RequestMatchResult)
|
.OrderBy(m => m.RequestMatchResult)
|
||||||
.ThenBy(m => m.Mapping.Priority)
|
.ThenBy(m => m.Mapping.Priority)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
if (_options.PartialMappingSettings?.EnforceHttpMethod == true)
|
||||||
|
{
|
||||||
|
// Check if any partialMappings contain a HttpMethodMatcher, and check if this returns a 0
|
||||||
|
foreach (var partialMapping in partialMappings)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var partialMatch = partialMappings.FirstOrDefault(pm => pm.RequestMatchResult.AverageTotalScore > 0.0);
|
var partialMatch = partialMappings.FirstOrDefault(pm => pm.RequestMatchResult.AverageTotalScore > 0.0);
|
||||||
|
|
||||||
if (_options.AllowPartialMapping == true)
|
if (_options.AllowPartialMapping == true)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using WireMock.Handlers;
|
|||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
using WireMock.Matchers;
|
using WireMock.Matchers;
|
||||||
using WireMock.Util;
|
using WireMock.Util;
|
||||||
|
using WireMock.Settings;
|
||||||
#if !USE_ASPNETCORE
|
#if !USE_ASPNETCORE
|
||||||
using Owin;
|
using Owin;
|
||||||
#else
|
#else
|
||||||
@@ -22,6 +23,8 @@ namespace WireMock.Owin
|
|||||||
|
|
||||||
public bool? AllowPartialMapping { get; set; }
|
public bool? AllowPartialMapping { get; set; }
|
||||||
|
|
||||||
|
public IPartialMappingSettings PartialMappingSettings { get; set; }
|
||||||
|
|
||||||
public ConcurrentDictionary<Guid, IMapping> Mappings { get; } = new ConcurrentDictionary<Guid, IMapping>();
|
public ConcurrentDictionary<Guid, IMapping> Mappings { get; } = new ConcurrentDictionary<Guid, IMapping>();
|
||||||
|
|
||||||
public ConcurrentDictionary<string, ScenarioState> Scenarios { get; } = new ConcurrentDictionary<string, ScenarioState>();
|
public ConcurrentDictionary<string, ScenarioState> Scenarios { get; } = new ConcurrentDictionary<string, ScenarioState>();
|
||||||
@@ -53,25 +56,5 @@ namespace WireMock.Owin
|
|||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.HandleRequestsSynchronously"/>
|
/// <inheritdoc cref="IWireMockMiddlewareOptions.HandleRequestsSynchronously"/>
|
||||||
public bool? HandleRequestsSynchronously { get; set; }
|
public bool? HandleRequestsSynchronously { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.X509StoreName"/>
|
|
||||||
public string X509StoreName { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.X509StoreLocation"/>
|
|
||||||
public string X509StoreLocation { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.X509ThumbprintOrSubjectName"/>
|
|
||||||
public string X509ThumbprintOrSubjectName { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.X509CertificateFilePath"/>
|
|
||||||
public string X509CertificateFilePath { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.X509CertificatePassword"/>
|
|
||||||
public string X509CertificatePassword { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockMiddlewareOptions.CustomCertificateDefined"/>
|
|
||||||
public bool CustomCertificateDefined =>
|
|
||||||
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
|
|
||||||
!string.IsNullOrEmpty(X509CertificateFilePath) && !string.IsNullOrEmpty(X509CertificatePassword);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using WireMock.ResponseProviders;
|
using WireMock.ResponseProviders;
|
||||||
|
|
||||||
@@ -16,12 +15,5 @@ namespace WireMock.ResponseBuilders
|
|||||||
/// <returns>The <see cref="IResponseBuilder"/>.</returns>
|
/// <returns>The <see cref="IResponseBuilder"/>.</returns>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
IResponseBuilder WithCallback([NotNull] Func<RequestMessage, ResponseMessage> callbackHandler);
|
IResponseBuilder WithCallback([NotNull] Func<RequestMessage, ResponseMessage> callbackHandler);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The async callback builder
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The <see cref="IResponseBuilder"/>.</returns>
|
|
||||||
[PublicAPI]
|
|
||||||
IResponseBuilder WithCallback([NotNull] Func<RequestMessage, Task<ResponseMessage>> callbackHandler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WireMock.Validation;
|
|
||||||
|
|
||||||
namespace WireMock.ResponseBuilders
|
|
||||||
{
|
|
||||||
public partial class Response
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A delegate to execute to generate the response.
|
|
||||||
/// </summary>
|
|
||||||
public Func<RequestMessage, ResponseMessage> Callback { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A delegate to execute to generate the response async.
|
|
||||||
/// </summary>
|
|
||||||
public Func<RequestMessage, Task<ResponseMessage>> CallbackAsync { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines if the method WithCallback(...) is used.
|
|
||||||
/// </summary>
|
|
||||||
public bool WithCallbackUsed { get; private set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="ICallbackResponseBuilder.WithCallback(Func{RequestMessage, ResponseMessage})"/>
|
|
||||||
public IResponseBuilder WithCallback(Func<RequestMessage, ResponseMessage> callbackHandler)
|
|
||||||
{
|
|
||||||
Check.NotNull(callbackHandler, nameof(callbackHandler));
|
|
||||||
|
|
||||||
return WithCallbackInternal(true, callbackHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc cref="ICallbackResponseBuilder.WithCallback(Func{RequestMessage, Task{ResponseMessage}})"/>
|
|
||||||
public IResponseBuilder WithCallback(Func<RequestMessage, Task<ResponseMessage>> callbackHandler)
|
|
||||||
{
|
|
||||||
Check.NotNull(callbackHandler, nameof(callbackHandler));
|
|
||||||
|
|
||||||
return WithCallbackInternal(true, callbackHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IResponseBuilder WithCallbackInternal(bool withCallbackUsed, Func<RequestMessage, ResponseMessage> callbackHandler)
|
|
||||||
{
|
|
||||||
Check.NotNull(callbackHandler, nameof(callbackHandler));
|
|
||||||
|
|
||||||
WithCallbackUsed = withCallbackUsed;
|
|
||||||
Callback = callbackHandler;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private IResponseBuilder WithCallbackInternal(bool withCallbackUsed, Func<RequestMessage, Task<ResponseMessage>> callbackHandler)
|
|
||||||
{
|
|
||||||
Check.NotNull(callbackHandler, nameof(callbackHandler));
|
|
||||||
|
|
||||||
WithCallbackUsed = withCallbackUsed;
|
|
||||||
CallbackAsync = callbackHandler;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -42,6 +42,16 @@ namespace WireMock.ResponseBuilders
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ResponseMessage ResponseMessage { get; }
|
public ResponseMessage ResponseMessage { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A delegate to execute to generate the response.
|
||||||
|
/// </summary>
|
||||||
|
public Func<RequestMessage, ResponseMessage> Callback { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines if the method WithCallback(...) is used.
|
||||||
|
/// </summary>
|
||||||
|
public bool WithCallbackUsed { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates this instance.
|
/// Creates this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -301,6 +311,25 @@ namespace WireMock.ResponseBuilders
|
|||||||
return WithDelay(TimeSpan.FromMilliseconds(milliseconds));
|
return WithDelay(TimeSpan.FromMilliseconds(milliseconds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="ICallbackResponseBuilder.WithCallback"/>
|
||||||
|
public IResponseBuilder WithCallback(Func<RequestMessage, ResponseMessage> callbackHandler)
|
||||||
|
{
|
||||||
|
Check.NotNull(callbackHandler, nameof(callbackHandler));
|
||||||
|
|
||||||
|
return WithCallbackInternal(true, callbackHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="ICallbackResponseBuilder.WithCallback"/>
|
||||||
|
private IResponseBuilder WithCallbackInternal(bool withCallbackUsed, Func<RequestMessage, ResponseMessage> callbackHandler)
|
||||||
|
{
|
||||||
|
Check.NotNull(callbackHandler, nameof(callbackHandler));
|
||||||
|
|
||||||
|
WithCallbackUsed = withCallbackUsed;
|
||||||
|
Callback = callbackHandler;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="IResponseProvider.ProvideResponseAsync(RequestMessage, IWireMockServerSettings)"/>
|
/// <inheritdoc cref="IResponseProvider.ProvideResponseAsync(RequestMessage, IWireMockServerSettings)"/>
|
||||||
public async Task<ResponseMessage> ProvideResponseAsync(RequestMessage requestMessage, IWireMockServerSettings settings)
|
public async Task<ResponseMessage> ProvideResponseAsync(RequestMessage requestMessage, IWireMockServerSettings settings)
|
||||||
{
|
{
|
||||||
@@ -336,20 +365,13 @@ namespace WireMock.ResponseBuilders
|
|||||||
}
|
}
|
||||||
|
|
||||||
ResponseMessage responseMessage;
|
ResponseMessage responseMessage;
|
||||||
if (Callback == null && CallbackAsync == null)
|
if (Callback == null)
|
||||||
{
|
{
|
||||||
responseMessage = ResponseMessage;
|
responseMessage = ResponseMessage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (Callback != null)
|
|
||||||
{
|
{
|
||||||
responseMessage = Callback(requestMessage);
|
responseMessage = Callback(requestMessage);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responseMessage = await CallbackAsync(requestMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!WithCallbackUsed)
|
if (!WithCallbackUsed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace WireMock.Serialization
|
|||||||
string matcherName = parts[0];
|
string matcherName = parts[0];
|
||||||
string matcherType = parts.Length > 1 ? parts[1] : null;
|
string matcherType = parts.Length > 1 ? parts[1] : null;
|
||||||
|
|
||||||
string[] stringPatterns = (matcher.Patterns != null ? matcher.Patterns : new[] { matcher.Pattern }).OfType<string>().ToArray();
|
string[] stringPatterns = matcher.Patterns != null ? matcher.Patterns.OfType<string>().ToArray() : new[] { matcher.Pattern as string };
|
||||||
MatchBehaviour matchBehaviour = matcher.RejectOnMatch == true ? MatchBehaviour.RejectOnMatch : MatchBehaviour.AcceptOnMatch;
|
MatchBehaviour matchBehaviour = matcher.RejectOnMatch == true ? MatchBehaviour.RejectOnMatch : MatchBehaviour.AcceptOnMatch;
|
||||||
bool ignoreCase = matcher.IgnoreCase == true;
|
bool ignoreCase = matcher.IgnoreCase == true;
|
||||||
bool throwExceptionWhenMatcherFails = _settings.ThrowExceptionWhenMatcherFails == true;
|
bool throwExceptionWhenMatcherFails = _settings.ThrowExceptionWhenMatcherFails == true;
|
||||||
@@ -64,8 +64,7 @@ namespace WireMock.Serialization
|
|||||||
return new RegexMatcher(matchBehaviour, stringPatterns, ignoreCase, throwExceptionWhenMatcherFails);
|
return new RegexMatcher(matchBehaviour, stringPatterns, ignoreCase, throwExceptionWhenMatcherFails);
|
||||||
|
|
||||||
case "JsonMatcher":
|
case "JsonMatcher":
|
||||||
object value = matcher.Pattern ?? matcher.Patterns;
|
return new JsonMatcher(matchBehaviour, stringPatterns, ignoreCase, throwExceptionWhenMatcherFails);
|
||||||
return new JsonMatcher(matchBehaviour, value, ignoreCase, throwExceptionWhenMatcherFails);
|
|
||||||
|
|
||||||
case "JsonPathMatcher":
|
case "JsonPathMatcher":
|
||||||
return new JsonPathMatcher(matchBehaviour, throwExceptionWhenMatcherFails, stringPatterns);
|
return new JsonPathMatcher(matchBehaviour, throwExceptionWhenMatcherFails, stringPatterns);
|
||||||
|
|||||||
@@ -367,6 +367,7 @@ namespace WireMock.Server
|
|||||||
if (settings.AllowPartialMapping != null)
|
if (settings.AllowPartialMapping != null)
|
||||||
{
|
{
|
||||||
_options.AllowPartialMapping = settings.AllowPartialMapping.Value;
|
_options.AllowPartialMapping = settings.AllowPartialMapping.Value;
|
||||||
|
// TODO stef _options.PartialMappingSettings = settings.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.GlobalProcessingDelay != null)
|
if (settings.GlobalProcessingDelay != null)
|
||||||
|
|||||||
@@ -230,15 +230,6 @@ namespace WireMock.Server
|
|||||||
_options.DisableJsonBodyParsing = _settings.DisableJsonBodyParsing;
|
_options.DisableJsonBodyParsing = _settings.DisableJsonBodyParsing;
|
||||||
_options.HandleRequestsSynchronously = settings.HandleRequestsSynchronously;
|
_options.HandleRequestsSynchronously = settings.HandleRequestsSynchronously;
|
||||||
|
|
||||||
if (settings.CustomCertificateDefined)
|
|
||||||
{
|
|
||||||
_options.X509StoreName = settings.CertificateSettings.X509StoreName;
|
|
||||||
_options.X509StoreLocation = settings.CertificateSettings.X509StoreLocation;
|
|
||||||
_options.X509ThumbprintOrSubjectName = settings.CertificateSettings.X509StoreThumbprintOrSubjectName;
|
|
||||||
_options.X509CertificateFilePath = settings.CertificateSettings.X509CertificateFilePath;
|
|
||||||
_options.X509CertificatePassword = settings.CertificateSettings.X509CertificatePassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
_matcherMapper = new MatcherMapper(_settings);
|
_matcherMapper = new MatcherMapper(_settings);
|
||||||
_mappingConverter = new MappingConverter(_matcherMapper);
|
_mappingConverter = new MappingConverter(_matcherMapper);
|
||||||
|
|
||||||
@@ -292,7 +283,7 @@ namespace WireMock.Server
|
|||||||
|
|
||||||
if (settings.AllowPartialMapping == true)
|
if (settings.AllowPartialMapping == true)
|
||||||
{
|
{
|
||||||
AllowPartialMapping();
|
AllowPartialMapping(true, settings.PartialMappingSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.StartAdminInterface == true)
|
if (settings.StartAdminInterface == true)
|
||||||
@@ -398,10 +389,21 @@ namespace WireMock.Server
|
|||||||
|
|
||||||
/// <inheritdoc cref="IWireMockServer.AllowPartialMapping" />
|
/// <inheritdoc cref="IWireMockServer.AllowPartialMapping" />
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public void AllowPartialMapping(bool allow = true)
|
public void AllowPartialMapping(bool allow = true, bool enforceHttpMethod = false)
|
||||||
|
{
|
||||||
|
AllowPartialMapping(allow, new PartialMappingSettings
|
||||||
|
{
|
||||||
|
EnforceHttpMethod = enforceHttpMethod
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc cref="IWireMockServer.AllowPartialMapping" />
|
||||||
|
[PublicAPI]
|
||||||
|
public void AllowPartialMapping(bool allow = true, IPartialMappingSettings partialMappingSettings = null)
|
||||||
{
|
{
|
||||||
_settings.Logger.Info("AllowPartialMapping is set to {0}", allow);
|
_settings.Logger.Info("AllowPartialMapping is set to {0}", allow);
|
||||||
_options.AllowPartialMapping = allow;
|
_options.AllowPartialMapping = allow;
|
||||||
|
_options.PartialMappingSettings = partialMappingSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockServer.SetBasicAuthentication" />
|
/// <inheritdoc cref="IWireMockServer.SetBasicAuthentication" />
|
||||||
|
|||||||
13
src/WireMock.Net/Settings/IPartialMappingSettings.cs
Normal file
13
src/WireMock.Net/Settings/IPartialMappingSettings.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace WireMock.Settings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// IPartialMappingSettings
|
||||||
|
/// </summary>
|
||||||
|
public interface IPartialMappingSettings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ...
|
||||||
|
/// </summary>
|
||||||
|
bool EnforceHttpMethod { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
namespace WireMock.Settings
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// If https is used, these settings can be used to configure the CertificateSettings in case a custom certificate instead the default .NET certificate should be used.
|
|
||||||
///
|
|
||||||
/// X509StoreName and X509StoreLocation should be defined
|
|
||||||
/// OR
|
|
||||||
/// X509CertificateFilePath and X509CertificatePassword should be defined
|
|
||||||
/// </summary>
|
|
||||||
public interface IWireMockCertificateSettings
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// X509 StoreName (AddressBook, AuthRoot, CertificateAuthority, My, Root, TrustedPeople or TrustedPublisher)
|
|
||||||
/// </summary>
|
|
||||||
string X509StoreName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X509 StoreLocation (CurrentUser or LocalMachine)
|
|
||||||
/// </summary>
|
|
||||||
string X509StoreLocation { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X509 Thumbprint or SubjectName (if not defined, the 'host' is used)
|
|
||||||
/// </summary>
|
|
||||||
string X509StoreThumbprintOrSubjectName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X509Certificate FilePath
|
|
||||||
/// </summary>
|
|
||||||
string X509CertificateFilePath { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X509Certificate Password
|
|
||||||
/// </summary>
|
|
||||||
string X509CertificatePassword { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X509StoreName and X509StoreLocation should be defined
|
|
||||||
/// OR
|
|
||||||
/// X509CertificateFilePath and X509CertificatePassword should be defined
|
|
||||||
/// </summary>
|
|
||||||
bool IsDefined { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -73,6 +73,12 @@ namespace WireMock.Settings
|
|||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
bool? AllowPartialMapping { get; set; }
|
bool? AllowPartialMapping { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the partial mapping settings (optional).
|
||||||
|
/// </summary>
|
||||||
|
[PublicAPI]
|
||||||
|
IPartialMappingSettings PartialMappingSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The username needed for __admin access.
|
/// The username needed for __admin access.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -170,21 +176,5 @@ namespace WireMock.Settings
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
bool? ThrowExceptionWhenMatcherFails { get; set; }
|
bool? ThrowExceptionWhenMatcherFails { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// If https is used, these settings can be used to configure the CertificateSettings in case a custom certificate instead the default .NET certificate should be used.
|
|
||||||
///
|
|
||||||
/// X509StoreName and X509StoreLocation should be defined
|
|
||||||
/// OR
|
|
||||||
/// X509CertificateFilePath and X509CertificatePassword should be defined
|
|
||||||
/// </summary>
|
|
||||||
[PublicAPI]
|
|
||||||
IWireMockCertificateSettings CertificateSettings { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines if custom CertificateSettings are defined
|
|
||||||
/// </summary>
|
|
||||||
[PublicAPI]
|
|
||||||
bool CustomCertificateDefined { get; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
15
src/WireMock.Net/Settings/PartialMappingSettings.cs
Normal file
15
src/WireMock.Net/Settings/PartialMappingSettings.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
|
namespace WireMock.Settings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PartialMappingSettings
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="IPartialMappingSettings" />
|
||||||
|
public class PartialMappingSettings : IPartialMappingSettings
|
||||||
|
{
|
||||||
|
/// <inheritdoc cref="IPartialMappingSettings.EnforceHttpMethod"/>
|
||||||
|
[PublicAPI]
|
||||||
|
public bool EnforceHttpMethod { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using JetBrains.Annotations;
|
|
||||||
|
|
||||||
namespace WireMock.Settings
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// <see cref="IWireMockCertificateSettings"/>
|
|
||||||
/// </summary>
|
|
||||||
public class WireMockCertificateSettings : IWireMockCertificateSettings
|
|
||||||
{
|
|
||||||
/// <inheritdoc cref="IWireMockCertificateSettings.X509StoreName"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public string X509StoreName { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockCertificateSettings.X509StoreLocation"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public string X509StoreLocation { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockCertificateSettings.X509StoreThumbprintOrSubjectName"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public string X509StoreThumbprintOrSubjectName { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockCertificateSettings.X509CertificateFilePath"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public string X509CertificateFilePath { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockCertificateSettings.X509CertificatePassword"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public string X509CertificatePassword { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockCertificateSettings.IsDefined"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public bool IsDefined =>
|
|
||||||
!string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) ||
|
|
||||||
!string.IsNullOrEmpty(X509CertificateFilePath) && !string.IsNullOrEmpty(X509CertificatePassword);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using HandlebarsDotNet;
|
||||||
using HandlebarsDotNet;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using WireMock.Handlers;
|
using WireMock.Handlers;
|
||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
@@ -53,6 +53,10 @@ namespace WireMock.Settings
|
|||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public bool? AllowPartialMapping { get; set; }
|
public bool? AllowPartialMapping { get; set; }
|
||||||
|
|
||||||
|
/// <inheritdoc cref="IWireMockServerSettings.PartialMappingSettings"/>
|
||||||
|
[PublicAPI]
|
||||||
|
public IPartialMappingSettings PartialMappingSettings { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockServerSettings.AdminUsername"/>
|
/// <inheritdoc cref="IWireMockServerSettings.AdminUsername"/>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public string AdminUsername { get; set; }
|
public string AdminUsername { get; set; }
|
||||||
@@ -121,13 +125,5 @@ namespace WireMock.Settings
|
|||||||
/// <inheritdoc cref="IWireMockServerSettings.ThrowExceptionWhenMatcherFails"/>
|
/// <inheritdoc cref="IWireMockServerSettings.ThrowExceptionWhenMatcherFails"/>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public bool? ThrowExceptionWhenMatcherFails { get; set; }
|
public bool? ThrowExceptionWhenMatcherFails { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockServerSettings.CertificateSettings"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public IWireMockCertificateSettings CertificateSettings { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc cref="IWireMockServerSettings.CustomCertificateDefined"/>
|
|
||||||
[PublicAPI]
|
|
||||||
public bool CustomCertificateDefined => CertificateSettings?.IsDefined == true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,12 +60,12 @@ namespace WireMock.Settings
|
|||||||
settings.Urls = parser.GetValues("Urls", new[] { "http://*:9091/" });
|
settings.Urls = parser.GetValues("Urls", new[] { "http://*:9091/" });
|
||||||
}
|
}
|
||||||
|
|
||||||
string proxyUrl = parser.GetStringValue("ProxyURL") ?? parser.GetStringValue("ProxyUrl");
|
string proxyURL = parser.GetStringValue("ProxyURL");
|
||||||
if (!string.IsNullOrEmpty(proxyUrl))
|
if (!string.IsNullOrEmpty(proxyURL))
|
||||||
{
|
{
|
||||||
settings.ProxyAndRecordSettings = new ProxyAndRecordSettings
|
settings.ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||||
{
|
{
|
||||||
Url = proxyUrl,
|
Url = proxyURL,
|
||||||
SaveMapping = parser.GetBoolValue("SaveMapping"),
|
SaveMapping = parser.GetBoolValue("SaveMapping"),
|
||||||
SaveMappingToFile = parser.GetBoolValue("SaveMappingToFile"),
|
SaveMappingToFile = parser.GetBoolValue("SaveMappingToFile"),
|
||||||
SaveMappingForStatusCodePattern = parser.GetStringValue("SaveMappingForStatusCodePattern"),
|
SaveMappingForStatusCodePattern = parser.GetStringValue("SaveMappingForStatusCodePattern"),
|
||||||
@@ -87,19 +87,6 @@ namespace WireMock.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var certificateSettings = new WireMockCertificateSettings
|
|
||||||
{
|
|
||||||
X509StoreName = parser.GetStringValue("X509StoreName"),
|
|
||||||
X509StoreLocation = parser.GetStringValue("X509StoreLocation"),
|
|
||||||
X509StoreThumbprintOrSubjectName = parser.GetStringValue("X509StoreThumbprintOrSubjectName"),
|
|
||||||
X509CertificateFilePath = parser.GetStringValue("X509CertificateFilePath"),
|
|
||||||
X509CertificatePassword = parser.GetStringValue("X509CertificatePassword")
|
|
||||||
};
|
|
||||||
if (certificateSettings.IsDefined)
|
|
||||||
{
|
|
||||||
settings.CertificateSettings = certificateSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Net;
|
||||||
using System.Net;
|
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
@@ -33,23 +32,21 @@ namespace WireMock.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extract the if-isHttps, protocol, host and port from a URL.
|
/// Extract the protocol, host and port from a URL.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool TryExtract(string url, out bool isHttps, out string protocol, out string host, out int port)
|
public static bool TryExtract(string url, out string protocol, out string host, out int port)
|
||||||
{
|
{
|
||||||
isHttps = false;
|
|
||||||
protocol = null;
|
protocol = null;
|
||||||
host = null;
|
host = null;
|
||||||
port = default;
|
port = default(int);
|
||||||
|
|
||||||
var match = UrlDetailsRegex.Match(url);
|
Match m = UrlDetailsRegex.Match(url);
|
||||||
if (match.Success)
|
if (m.Success)
|
||||||
{
|
{
|
||||||
protocol = match.Groups["proto"].Value;
|
protocol = m.Groups["proto"].Value;
|
||||||
isHttps = protocol.StartsWith("https", StringComparison.OrdinalIgnoreCase);
|
host = m.Groups["host"].Value;
|
||||||
host = match.Groups["host"].Value;
|
|
||||||
|
|
||||||
return int.TryParse(match.Groups["port"].Value, out port);
|
return int.TryParse(m.Groups["port"].Value, out port);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.12" />
|
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.12" />
|
||||||
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.12" />
|
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.12" />
|
||||||
<PackageReference Include="JmesPath.Net" Version="1.0.125" />
|
<PackageReference Include="JmesPath.Net" Version="1.0.125" />
|
||||||
<PackageReference Include="Handlebars.Net.Helpers" Version="1.1.0" />
|
<PackageReference Include="Handlebars.Net.Helpers" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)' == 'Debug - Sonar'">
|
<ItemGroup Condition="'$(Configuration)' == 'Debug - Sonar'">
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ using WireMock.Server;
|
|||||||
using Xunit;
|
using Xunit;
|
||||||
using WireMock.FluentAssertions;
|
using WireMock.FluentAssertions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using WireMock.Settings;
|
|
||||||
using static System.Environment;
|
using static System.Environment;
|
||||||
|
|
||||||
namespace WireMock.Net.Tests.FluentAssertions
|
namespace WireMock.Net.Tests.FluentAssertions
|
||||||
@@ -24,10 +23,10 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
{
|
{
|
||||||
_server = WireMockServer.Start();
|
_server = WireMockServer.Start();
|
||||||
_server.Given(Request.Create().UsingAnyMethod())
|
_server.Given(Request.Create().UsingAnyMethod())
|
||||||
.RespondWith(Response.Create().WithSuccess());
|
.RespondWith(Response.Create().WithStatusCode(200));
|
||||||
_portUsed = _server.Ports.First();
|
_portUsed = _server.Ports.First();
|
||||||
|
|
||||||
_httpClient = new HttpClient { BaseAddress = new Uri(_server.Urls[0]) };
|
_httpClient = new HttpClient { BaseAddress = new Uri($"http://localhost:{_portUsed}") };
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -157,134 +156,6 @@ namespace WireMock.Net.Tests.FluentAssertions
|
|||||||
.Be($"{string.Join(NewLine, missingValue1Message, missingValue2Message)}{NewLine}");
|
.Be($"{string.Join(NewLine, missingValue1Message, missingValue2Message)}{NewLine}");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task AtUrl_WhenACallWasMadeToUrl_Should_BeOK()
|
|
||||||
{
|
|
||||||
await _httpClient.GetAsync("anyurl");
|
|
||||||
|
|
||||||
_server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.AtUrl($"http://localhost:{_portUsed}/anyurl");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void AtUrl_Should_ThrowWhenNoCallsWereMade()
|
|
||||||
{
|
|
||||||
Action act = () => _server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.AtUrl("anyurl");
|
|
||||||
|
|
||||||
act.Should().Throw<Exception>()
|
|
||||||
.And.Message.Should()
|
|
||||||
.Be(
|
|
||||||
"Expected _server to have been called at address matching the url \"anyurl\", but no calls were made.");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task AtUrl_Should_ThrowWhenNoCallsMatchingTheUrlWereMade()
|
|
||||||
{
|
|
||||||
await _httpClient.GetAsync("");
|
|
||||||
|
|
||||||
Action act = () => _server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.AtUrl("anyurl");
|
|
||||||
|
|
||||||
act.Should().Throw<Exception>()
|
|
||||||
.And.Message.Should()
|
|
||||||
.Be(
|
|
||||||
$"Expected _server to have been called at address matching the url \"anyurl\", but didn't find it among the calls to {{\"http://localhost:{_portUsed}/\"}}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task WithProxyUrl_WhenACallWasMadeWithProxyUrl_Should_BeOK()
|
|
||||||
{
|
|
||||||
_server.ResetMappings();
|
|
||||||
_server.Given(Request.Create().UsingAnyMethod())
|
|
||||||
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings {Url = "http://localhost:9999"}));
|
|
||||||
|
|
||||||
await _httpClient.GetAsync("");
|
|
||||||
|
|
||||||
_server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.WithProxyUrl($"http://localhost:9999");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void WithProxyUrl_Should_ThrowWhenNoCallsWereMade()
|
|
||||||
{
|
|
||||||
_server.ResetMappings();
|
|
||||||
_server.Given(Request.Create().UsingAnyMethod())
|
|
||||||
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings {Url = "http://localhost:9999"}));
|
|
||||||
|
|
||||||
Action act = () => _server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.WithProxyUrl("anyurl");
|
|
||||||
|
|
||||||
act.Should().Throw<Exception>()
|
|
||||||
.And.Message.Should()
|
|
||||||
.Be(
|
|
||||||
"Expected _server to have been called with proxy url \"anyurl\", but no calls were made.");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task WithProxyUrl_Should_ThrowWhenNoCallsWithTheProxyUrlWereMade()
|
|
||||||
{
|
|
||||||
_server.ResetMappings();
|
|
||||||
_server.Given(Request.Create().UsingAnyMethod())
|
|
||||||
.RespondWith(Response.Create().WithProxy(new ProxyAndRecordSettings {Url = "http://localhost:9999"}));
|
|
||||||
|
|
||||||
await _httpClient.GetAsync("");
|
|
||||||
|
|
||||||
Action act = () => _server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.WithProxyUrl("anyurl");
|
|
||||||
|
|
||||||
act.Should().Throw<Exception>()
|
|
||||||
.And.Message.Should()
|
|
||||||
.Be(
|
|
||||||
$"Expected _server to have been called with proxy url \"anyurl\", but didn't find it among the calls with {{\"http://localhost:9999\"}}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task FromClientIP_whenACallWasMadeFromClientIP_Should_BeOK()
|
|
||||||
{
|
|
||||||
await _httpClient.GetAsync("");
|
|
||||||
var clientIP = _server.LogEntries.Last().RequestMessage.ClientIP;
|
|
||||||
|
|
||||||
_server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.FromClientIP(clientIP);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void FromClientIP_Should_ThrowWhenNoCallsWereMade()
|
|
||||||
{
|
|
||||||
Action act = () => _server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.FromClientIP("different-ip");
|
|
||||||
|
|
||||||
act.Should().Throw<Exception>()
|
|
||||||
.And.Message.Should()
|
|
||||||
.Be(
|
|
||||||
"Expected _server to have been called from client IP \"different-ip\", but no calls were made.");
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task FromClientIP_Should_ThrowWhenNoCallsFromClientIPWereMade()
|
|
||||||
{
|
|
||||||
await _httpClient.GetAsync("");
|
|
||||||
var clientIP = _server.LogEntries.Last().RequestMessage.ClientIP;
|
|
||||||
|
|
||||||
Action act = () => _server.Should()
|
|
||||||
.HaveReceivedACall()
|
|
||||||
.FromClientIP("different-ip");
|
|
||||||
|
|
||||||
act.Should().Throw<Exception>()
|
|
||||||
.And.Message.Should()
|
|
||||||
.Be(
|
|
||||||
$"Expected _server to have been called from client IP \"different-ip\", but didn't find it among the calls from IP(s) {{\"{clientIP}\"}}.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_server?.Stop();
|
_server?.Stop();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using NFluent;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
using FluentAssertions;
|
||||||
|
using NFluent;
|
||||||
using WireMock.Matchers.Request;
|
using WireMock.Matchers.Request;
|
||||||
using WireMock.Models;
|
using WireMock.Models;
|
||||||
using WireMock.RequestBuilders;
|
using WireMock.RequestBuilders;
|
||||||
@@ -13,6 +14,34 @@ namespace WireMock.Net.Tests
|
|||||||
{
|
{
|
||||||
private const string ClientIp = "::1";
|
private const string ClientIp = "::1";
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Should_Match_When_Verb_Does_Match()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var requestPut = Request.Create().WithPath("/bar").UsingPut();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var request = new RequestMessage(new UrlDetails("http://localhost/bar"), "PUT", ClientIp);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var requestMatchResult = new RequestMatchResult();
|
||||||
|
requestPut.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Should_NotMatch_When_Verb_Does_Not_Match()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var requestGet = Request.Create().WithPath("/bar").UsingGet();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var request = new RequestMessage(new UrlDetails("http://localhost/bar"), "PUT", ClientIp);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var requestMatchResult = new RequestMatchResult();
|
||||||
|
requestGet.GetMatchingScore(request, requestMatchResult).Should().Be(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Should_exclude_requests_matching_given_http_method_but_not_url()
|
public void Should_exclude_requests_matching_given_http_method_but_not_url()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,35 +13,6 @@ namespace WireMock.Net.Tests.ResponseBuilders
|
|||||||
{
|
{
|
||||||
private readonly WireMockServerSettings _settings = new WireMockServerSettings();
|
private readonly WireMockServerSettings _settings = new WireMockServerSettings();
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public async Task Response_WithCallbackAsync()
|
|
||||||
{
|
|
||||||
// Assign
|
|
||||||
var requestMessage = new RequestMessage(new UrlDetails("http://localhost/foo"), "GET", "::1");
|
|
||||||
var response = Response.Create()
|
|
||||||
.WithCallback(async request =>
|
|
||||||
{
|
|
||||||
await Task.Delay(1);
|
|
||||||
|
|
||||||
return new ResponseMessage
|
|
||||||
{
|
|
||||||
BodyData = new BodyData
|
|
||||||
{
|
|
||||||
DetectedBodyType = BodyType.String,
|
|
||||||
BodyAsString = request.Path + "Bar"
|
|
||||||
},
|
|
||||||
StatusCode = 302
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var responseMessage = await response.ProvideResponseAsync(requestMessage, _settings);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
responseMessage.BodyData.BodyAsString.Should().Be("/fooBar");
|
|
||||||
responseMessage.StatusCode.Should().Be(302);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Response_WithCallback()
|
public async Task Response_WithCallback()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using Moq;
|
||||||
using FluentAssertions;
|
|
||||||
using Moq;
|
|
||||||
using NFluent;
|
using NFluent;
|
||||||
|
using System;
|
||||||
using WireMock.Admin.Mappings;
|
using WireMock.Admin.Mappings;
|
||||||
using WireMock.Matchers;
|
using WireMock.Matchers;
|
||||||
using WireMock.Serialization;
|
using WireMock.Serialization;
|
||||||
@@ -27,7 +26,7 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var model = _sut.Map((IMatcher)null);
|
var model = _sut.Map((IMatcher)null);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
model.Should().BeNull();
|
Check.That(model).IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -37,7 +36,7 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var model = _sut.Map((IMatcher[])null);
|
var model = _sut.Map((IMatcher[])null);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
model.Should().BeNull();
|
Check.That(model).IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -51,7 +50,7 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var models = _sut.Map(new[] { matcherMock1.Object, matcherMock2.Object });
|
var models = _sut.Map(new[] { matcherMock1.Object, matcherMock2.Object });
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
models.Should().HaveCount(2);
|
Check.That(models).HasSize(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -66,10 +65,10 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var model = _sut.Map(matcherMock.Object);
|
var model = _sut.Map(matcherMock.Object);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
model.IgnoreCase.Should().BeNull();
|
Check.That(model.IgnoreCase).IsNull();
|
||||||
model.Name.Should().Be("test");
|
Check.That(model.Name).Equals("test");
|
||||||
model.Pattern.Should().BeNull();
|
Check.That(model.Pattern).IsNull();
|
||||||
model.Patterns.Should().Contain("p1", "p2");
|
Check.That(model.Patterns).ContainsExactly("p1", "p2");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -83,7 +82,7 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var model = _sut.Map(matcherMock.Object);
|
var model = _sut.Map(matcherMock.Object);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
model.IgnoreCase.Should().BeTrue();
|
Check.That(model.IgnoreCase).Equals(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -93,7 +92,7 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var result = _sut.Map((MatcherModel)null);
|
var result = _sut.Map((MatcherModel)null);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeNull();
|
Check.That(result).IsNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -120,8 +119,8 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var matcher = (LinqMatcher)_sut.Map(model);
|
var matcher = (LinqMatcher)_sut.Map(model);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
|
Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch);
|
||||||
matcher.GetPatterns().Should().Contain("p");
|
Check.That(matcher.GetPatterns()).ContainsExactly("p");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -138,88 +137,8 @@ namespace WireMock.Net.Tests.Serialization
|
|||||||
var matcher = (LinqMatcher)_sut.Map(model);
|
var matcher = (LinqMatcher)_sut.Map(model);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
|
Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch);
|
||||||
matcher.GetPatterns().Should().Contain("p1", "p2");
|
Check.That(matcher.GetPatterns()).ContainsExactly("p1", "p2");
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void MatcherMapper_Map_MatcherModel_JsonMatcher_Pattern_As_String()
|
|
||||||
{
|
|
||||||
// Assign
|
|
||||||
var pattern = "{ \"AccountIds\": [ 1, 2, 3 ] }";
|
|
||||||
var model = new MatcherModel
|
|
||||||
{
|
|
||||||
Name = "JsonMatcher",
|
|
||||||
Pattern = pattern
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var matcher = (JsonMatcher)_sut.Map(model);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
|
|
||||||
matcher.Value.Should().BeEquivalentTo(pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void MatcherMapper_Map_MatcherModel_JsonMatcher_Patterns_As_String()
|
|
||||||
{
|
|
||||||
// Assign
|
|
||||||
var pattern1 = "{ \"AccountIds\": [ 1, 2, 3 ] }";
|
|
||||||
var pattern2 = "{ \"X\": \"x\" }";
|
|
||||||
var patterns = new[] { pattern1, pattern2 };
|
|
||||||
var model = new MatcherModel
|
|
||||||
{
|
|
||||||
Name = "JsonMatcher",
|
|
||||||
Pattern = patterns
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var matcher = (JsonMatcher)_sut.Map(model);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
|
|
||||||
matcher.Value.Should().BeEquivalentTo(patterns);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void MatcherMapper_Map_MatcherModel_JsonMatcher_Pattern_As_Object()
|
|
||||||
{
|
|
||||||
// Assign
|
|
||||||
var pattern = new { AccountIds = new[] { 1, 2, 3 } };
|
|
||||||
var model = new MatcherModel
|
|
||||||
{
|
|
||||||
Name = "JsonMatcher",
|
|
||||||
Pattern = pattern
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var matcher = (JsonMatcher)_sut.Map(model);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
|
|
||||||
matcher.Value.Should().BeEquivalentTo(pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void MatcherMapper_Map_MatcherModel_JsonMatcher_Patterns_As_Object()
|
|
||||||
{
|
|
||||||
// Assign
|
|
||||||
object pattern1 = new { AccountIds = new[] { 1, 2, 3 } };
|
|
||||||
object pattern2 = new { X = "x" };
|
|
||||||
var patterns = new[] { pattern1, pattern2 };
|
|
||||||
var model = new MatcherModel
|
|
||||||
{
|
|
||||||
Name = "JsonMatcher",
|
|
||||||
Patterns = patterns
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var matcher = (JsonMatcher)_sut.Map(model);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
|
|
||||||
matcher.Value.Should().BeEquivalentTo(patterns);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
using FluentAssertions;
|
|
||||||
using NFluent;
|
using NFluent;
|
||||||
using WireMock.Util;
|
using WireMock.Util;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@@ -14,14 +13,13 @@ namespace WireMock.Net.Tests.Util
|
|||||||
string url = "test";
|
string url = "test";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = PortUtils.TryExtract(url, out bool isHttps, out string proto, out string host, out int port);
|
bool result = PortUtils.TryExtract(url, out string proto, out string host, out int port);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeFalse();
|
Check.That(result).IsFalse();
|
||||||
isHttps.Should().BeFalse();
|
Check.That(proto).IsNull();
|
||||||
proto.Should().BeNull();
|
Check.That(host).IsNull();
|
||||||
host.Should().BeNull();
|
Check.That(port).IsEqualTo(default(int));
|
||||||
port.Should().Be(default(int));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -31,58 +29,39 @@ namespace WireMock.Net.Tests.Util
|
|||||||
string url = "http://0.0.0.0";
|
string url = "http://0.0.0.0";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = PortUtils.TryExtract(url, out bool isHttps, out string proto, out string host, out int port);
|
bool result = PortUtils.TryExtract(url, out string proto, out string host, out int port);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeFalse();
|
Check.That(result).IsFalse();
|
||||||
isHttps.Should().BeFalse();
|
Check.That(proto).IsNull();
|
||||||
proto.Should().BeNull();
|
Check.That(host).IsNull();
|
||||||
host.Should().BeNull();
|
Check.That(port).IsEqualTo(default(int));
|
||||||
port.Should().Be(default(int));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void PortUtils_TryExtract_Http_Returns_True()
|
public void PortUtils_TryExtract_ValidUrl1_Returns_True()
|
||||||
{
|
|
||||||
// Assign
|
|
||||||
string url = "http://wiremock.net:1234";
|
|
||||||
|
|
||||||
// Act
|
|
||||||
bool result = PortUtils.TryExtract(url, out bool isHttps, out string proto, out string host, out int port);
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
result.Should().BeTrue();
|
|
||||||
isHttps.Should().BeFalse();
|
|
||||||
proto.Should().Be("http");
|
|
||||||
host.Should().Be("wiremock.net");
|
|
||||||
port.Should().Be(1234);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void PortUtils_TryExtract_Https_Returns_True()
|
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
string url = "https://wiremock.net:5000";
|
string url = "https://wiremock.net:5000";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = PortUtils.TryExtract(url, out bool isHttps, out string proto, out string host, out int port);
|
bool result = PortUtils.TryExtract(url, out string proto, out string host, out int port);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
result.Should().BeTrue();
|
Check.That(result).IsTrue();
|
||||||
isHttps.Should().BeTrue();
|
Check.That(proto).IsEqualTo("https");
|
||||||
proto.Should().Be("https");
|
Check.That(host).IsEqualTo("wiremock.net");
|
||||||
host.Should().Be("wiremock.net");
|
Check.That(port).IsEqualTo(5000);
|
||||||
port.Should().Be(5000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void PortUtils_TryExtract_Https0_0_0_0_Returns_True()
|
public void PortUtils_TryExtract_ValidUrl2_Returns_True()
|
||||||
{
|
{
|
||||||
// Assign
|
// Assign
|
||||||
string url = "https://0.0.0.0:5000";
|
string url = "https://0.0.0.0:5000";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
bool result = PortUtils.TryExtract(url, out bool isHttps, out string proto, out string host, out int port);
|
bool result = PortUtils.TryExtract(url, out string proto, out string host, out int port);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Check.That(result).IsTrue();
|
Check.That(result).IsTrue();
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FluentAssertions;
|
|
||||||
using WireMock.RequestBuilders;
|
|
||||||
using WireMock.ResponseBuilders;
|
|
||||||
using WireMock.Server;
|
|
||||||
using Xunit;
|
|
||||||
|
|
||||||
namespace WireMock.Net.Tests
|
|
||||||
{
|
|
||||||
public partial class WireMockServerTests
|
|
||||||
{
|
|
||||||
[Theory]
|
|
||||||
[InlineData(HttpStatusCode.Conflict)]
|
|
||||||
[InlineData(409)]
|
|
||||||
[InlineData("409")]
|
|
||||||
public async Task WireMockServer_WithCallback_Should_Use_StatusCodeFromResponse(object statusCode)
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var server = WireMockServer.Start();
|
|
||||||
server.Given(Request.Create().UsingPost().WithPath("/foo"))
|
|
||||||
.RespondWith(Response.Create()
|
|
||||||
.WithCallback(request => new ResponseMessage
|
|
||||||
{
|
|
||||||
StatusCode = statusCode
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Act
|
|
||||||
using var httpClient = new HttpClient();
|
|
||||||
var response = await httpClient.PostAsync("http://localhost:" + server.Ports[0] + "/foo", new StringContent("dummy"));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
response.StatusCode.Should().Be(409);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,7 @@ using Xunit;
|
|||||||
|
|
||||||
namespace WireMock.Net.Tests
|
namespace WireMock.Net.Tests
|
||||||
{
|
{
|
||||||
public partial class WireMockServerTests
|
public class WireMockServerTests
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task WireMockServer_Should_reset_requestlogs()
|
public async Task WireMockServer_Should_reset_requestlogs()
|
||||||
|
|||||||
Reference in New Issue
Block a user