mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-13 13:53:34 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b367299643 | ||
|
|
2179df7b44 | ||
|
|
8788d9ba4a | ||
|
|
d96ae9b063 | ||
|
|
ecb8e620ed | ||
|
|
780c233ef3 | ||
|
|
4d83d82b91 | ||
|
|
bf28ba79b5 | ||
|
|
90e017b79a | ||
|
|
2602db566b | ||
|
|
61937db0b3 | ||
|
|
8a60950620 |
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Build with Tests
|
||||
name: Run Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -10,47 +10,29 @@ on:
|
||||
|
||||
jobs:
|
||||
windows-build-and-run:
|
||||
name: Run Tests on Windows
|
||||
runs-on: windows-2022
|
||||
|
||||
env:
|
||||
IsRunningOnGitHubActions: 'true'
|
||||
|
||||
steps:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: |
|
||||
7.0.x
|
||||
8.0.x
|
||||
|
||||
- name: 'Build Unit Tests'
|
||||
run: |
|
||||
dotnet build './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net7.0
|
||||
|
||||
- name: 'Run Unit Tests'
|
||||
run: |
|
||||
dotnet test './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net7.0
|
||||
dotnet test './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net8.0
|
||||
|
||||
linux-build-and-run:
|
||||
name: Run Tests on Linux
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
IsRunningOnGitHubActions: 'true'
|
||||
|
||||
steps:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: |
|
||||
7.0.x
|
||||
8.0.x
|
||||
|
||||
- name: 'Build Unit Tests'
|
||||
run: |
|
||||
dotnet build './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net7.0
|
||||
|
||||
- name: 'Run Unit Tests'
|
||||
run: |
|
||||
dotnet test './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net7.0
|
||||
dotnet test './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj' -c Release --framework net8.0
|
||||
29
.runsettings
29
.runsettings
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RunSettings>
|
||||
<DataCollectionRunSettings>
|
||||
<DataCollectors>
|
||||
<DataCollector friendlyName="Code Coverage"
|
||||
uri="datacollector://Microsoft/CodeCoverage/2.0"
|
||||
assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<Configuration>
|
||||
<CodeCoverage>
|
||||
<ModulePaths>
|
||||
<Include>
|
||||
<ModulePath>.*\.dll$</ModulePath>
|
||||
</Include>
|
||||
<Exclude>
|
||||
<ModulePath>.*Validation.*</ModulePath>
|
||||
<ModulePath>.*\.tests.dll$</ModulePath>
|
||||
<ModulePath>.*simmetrics.*</ModulePath>
|
||||
</Exclude>
|
||||
</ModulePaths>
|
||||
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
|
||||
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
|
||||
<CollectFromChildProcesses>True</CollectFromChildProcesses>
|
||||
<CollectAspDotNet>False</CollectAspDotNet>
|
||||
</CodeCoverage>
|
||||
</Configuration>
|
||||
</DataCollector>
|
||||
</DataCollectors>
|
||||
</DataCollectionRunSettings>
|
||||
</RunSettings>
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"ServerUri": "https://sonarcloud.io",
|
||||
"Organization": {
|
||||
"Key": "stefh-github",
|
||||
"Name": "Stef Heyenrath (Organization)"
|
||||
},
|
||||
"ProjectKey": "wiremock",
|
||||
"Profiles": {
|
||||
"CSharp": {
|
||||
"ProfileKey": "AWRupN8iowGp6EI3lYmF",
|
||||
"ProfileTimestamp": "2018-09-06T11:06:47+02:00"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,362 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="SonarQube - wiremock Sonar way" Description="This rule set was automatically generated from SonarQube.
https://sonarcloud.io/profiles/show?key=AWRupN8iowGp6EI3lYmF" ToolsVersion="15.0">
|
||||
<Rules AnalyzerId="SonarAnalyzer.CSharp" RuleNamespace="SonarAnalyzer.CSharp">
|
||||
<Rule Id="S100" Action="None" />
|
||||
<Rule Id="S1006" Action="Warning" />
|
||||
<Rule Id="S101" Action="Warning" />
|
||||
<Rule Id="S103" Action="None" />
|
||||
<Rule Id="S104" Action="None" />
|
||||
<Rule Id="S1048" Action="Warning" />
|
||||
<Rule Id="S105" Action="None" />
|
||||
<Rule Id="S106" Action="None" />
|
||||
<Rule Id="S1066" Action="Warning" />
|
||||
<Rule Id="S1067" Action="None" />
|
||||
<Rule Id="S107" Action="Warning" />
|
||||
<Rule Id="S1075" Action="Warning" />
|
||||
<Rule Id="S108" Action="Warning" />
|
||||
<Rule Id="S109" Action="None" />
|
||||
<Rule Id="S110" Action="Warning" />
|
||||
<Rule Id="S1104" Action="Warning" />
|
||||
<Rule Id="S1109" Action="None" />
|
||||
<Rule Id="S1110" Action="Warning" />
|
||||
<Rule Id="S1116" Action="Warning" />
|
||||
<Rule Id="S1117" Action="Warning" />
|
||||
<Rule Id="S1118" Action="Warning" />
|
||||
<Rule Id="S112" Action="Warning" />
|
||||
<Rule Id="S1121" Action="Warning" />
|
||||
<Rule Id="S1123" Action="Warning" />
|
||||
<Rule Id="S1125" Action="Warning" />
|
||||
<Rule Id="S113" Action="None" />
|
||||
<Rule Id="S1134" Action="Warning" />
|
||||
<Rule Id="S1135" Action="Warning" />
|
||||
<Rule Id="S1144" Action="Warning" />
|
||||
<Rule Id="S1145" Action="None" />
|
||||
<Rule Id="S1147" Action="None" />
|
||||
<Rule Id="S1151" Action="None" />
|
||||
<Rule Id="S1155" Action="Warning" />
|
||||
<Rule Id="S1163" Action="Warning" />
|
||||
<Rule Id="S1168" Action="Warning" />
|
||||
<Rule Id="S1172" Action="Warning" />
|
||||
<Rule Id="S1185" Action="Warning" />
|
||||
<Rule Id="S1186" Action="Warning" />
|
||||
<Rule Id="S1192" Action="None" />
|
||||
<Rule Id="S1200" Action="None" />
|
||||
<Rule Id="S1206" Action="Warning" />
|
||||
<Rule Id="S121" Action="None" />
|
||||
<Rule Id="S1210" Action="Warning" />
|
||||
<Rule Id="S1215" Action="Warning" />
|
||||
<Rule Id="S122" Action="None" />
|
||||
<Rule Id="S1226" Action="None" />
|
||||
<Rule Id="S1227" Action="None" />
|
||||
<Rule Id="S1244" Action="None" />
|
||||
<Rule Id="S125" Action="Warning" />
|
||||
<Rule Id="S126" Action="None" />
|
||||
<Rule Id="S1264" Action="Warning" />
|
||||
<Rule Id="S127" Action="None" />
|
||||
<Rule Id="S1301" Action="None" />
|
||||
<Rule Id="S1309" Action="None" />
|
||||
<Rule Id="S131" Action="None" />
|
||||
<Rule Id="S1313" Action="None" />
|
||||
<Rule Id="S134" Action="None" />
|
||||
<Rule Id="S138" Action="None" />
|
||||
<Rule Id="S1449" Action="None" />
|
||||
<Rule Id="S1450" Action="Warning" />
|
||||
<Rule Id="S1451" Action="None" />
|
||||
<Rule Id="S1479" Action="Warning" />
|
||||
<Rule Id="S1481" Action="Warning" />
|
||||
<Rule Id="S1541" Action="None" />
|
||||
<Rule Id="S1607" Action="Warning" />
|
||||
<Rule Id="S1643" Action="Warning" />
|
||||
<Rule Id="S1656" Action="Warning" />
|
||||
<Rule Id="S1659" Action="None" />
|
||||
<Rule Id="S1694" Action="None" />
|
||||
<Rule Id="S1696" Action="None" />
|
||||
<Rule Id="S1697" Action="None" />
|
||||
<Rule Id="S1698" Action="None" />
|
||||
<Rule Id="S1699" Action="Warning" />
|
||||
<Rule Id="S1751" Action="Warning" />
|
||||
<Rule Id="S1764" Action="Warning" />
|
||||
<Rule Id="S1821" Action="None" />
|
||||
<Rule Id="S1848" Action="Warning" />
|
||||
<Rule Id="S1854" Action="Warning" />
|
||||
<Rule Id="S1858" Action="None" />
|
||||
<Rule Id="S1862" Action="Warning" />
|
||||
<Rule Id="S1871" Action="Warning" />
|
||||
<Rule Id="S1905" Action="Warning" />
|
||||
<Rule Id="S1939" Action="Warning" />
|
||||
<Rule Id="S1940" Action="Warning" />
|
||||
<Rule Id="S1944" Action="Warning" />
|
||||
<Rule Id="S1994" Action="None" />
|
||||
<Rule Id="S2068" Action="Warning" />
|
||||
<Rule Id="S2070" Action="None" />
|
||||
<Rule Id="S2092" Action="None" />
|
||||
<Rule Id="S2114" Action="Warning" />
|
||||
<Rule Id="S2123" Action="Warning" />
|
||||
<Rule Id="S2148" Action="None" />
|
||||
<Rule Id="S2156" Action="None" />
|
||||
<Rule Id="S2178" Action="Warning" />
|
||||
<Rule Id="S2183" Action="Warning" />
|
||||
<Rule Id="S2184" Action="Warning" />
|
||||
<Rule Id="S2187" Action="Warning" />
|
||||
<Rule Id="S2190" Action="Warning" />
|
||||
<Rule Id="S2197" Action="None" />
|
||||
<Rule Id="S2201" Action="Warning" />
|
||||
<Rule Id="S2219" Action="Warning" />
|
||||
<Rule Id="S2221" Action="None" />
|
||||
<Rule Id="S2223" Action="Warning" />
|
||||
<Rule Id="S2225" Action="Warning" />
|
||||
<Rule Id="S2228" Action="None" />
|
||||
<Rule Id="S2234" Action="Warning" />
|
||||
<Rule Id="S2245" Action="Warning" />
|
||||
<Rule Id="S2255" Action="Warning" />
|
||||
<Rule Id="S2259" Action="Warning" />
|
||||
<Rule Id="S2275" Action="Warning" />
|
||||
<Rule Id="S2278" Action="Warning" />
|
||||
<Rule Id="S2290" Action="Warning" />
|
||||
<Rule Id="S2291" Action="Warning" />
|
||||
<Rule Id="S2292" Action="Warning" />
|
||||
<Rule Id="S2302" Action="None" />
|
||||
<Rule Id="S2306" Action="Warning" />
|
||||
<Rule Id="S2325" Action="None" />
|
||||
<Rule Id="S2326" Action="Warning" />
|
||||
<Rule Id="S2327" Action="Warning" />
|
||||
<Rule Id="S2328" Action="Warning" />
|
||||
<Rule Id="S2330" Action="None" />
|
||||
<Rule Id="S2333" Action="None" />
|
||||
<Rule Id="S2339" Action="None" />
|
||||
<Rule Id="S2342" Action="Warning" />
|
||||
<Rule Id="S2344" Action="Warning" />
|
||||
<Rule Id="S2345" Action="Warning" />
|
||||
<Rule Id="S2346" Action="Warning" />
|
||||
<Rule Id="S2357" Action="None" />
|
||||
<Rule Id="S2360" Action="None" />
|
||||
<Rule Id="S2365" Action="Warning" />
|
||||
<Rule Id="S2368" Action="Warning" />
|
||||
<Rule Id="S2372" Action="Warning" />
|
||||
<Rule Id="S2376" Action="Warning" />
|
||||
<Rule Id="S2386" Action="Warning" />
|
||||
<Rule Id="S2387" Action="None" />
|
||||
<Rule Id="S2436" Action="Warning" />
|
||||
<Rule Id="S2437" Action="Warning" />
|
||||
<Rule Id="S2486" Action="Warning" />
|
||||
<Rule Id="S2551" Action="Warning" />
|
||||
<Rule Id="S2583" Action="Warning" />
|
||||
<Rule Id="S2589" Action="Warning" />
|
||||
<Rule Id="S2674" Action="None" />
|
||||
<Rule Id="S2681" Action="Warning" />
|
||||
<Rule Id="S2688" Action="Warning" />
|
||||
<Rule Id="S2692" Action="Warning" />
|
||||
<Rule Id="S2696" Action="Warning" />
|
||||
<Rule Id="S2699" Action="None" />
|
||||
<Rule Id="S2701" Action="None" />
|
||||
<Rule Id="S2737" Action="Warning" />
|
||||
<Rule Id="S2743" Action="Warning" />
|
||||
<Rule Id="S2757" Action="Warning" />
|
||||
<Rule Id="S2758" Action="Warning" />
|
||||
<Rule Id="S2760" Action="None" />
|
||||
<Rule Id="S2761" Action="Warning" />
|
||||
<Rule Id="S2930" Action="Warning" />
|
||||
<Rule Id="S2931" Action="None" />
|
||||
<Rule Id="S2933" Action="Warning" />
|
||||
<Rule Id="S2934" Action="Warning" />
|
||||
<Rule Id="S2952" Action="None" />
|
||||
<Rule Id="S2953" Action="Warning" />
|
||||
<Rule Id="S2955" Action="None" />
|
||||
<Rule Id="S2971" Action="Warning" />
|
||||
<Rule Id="S2995" Action="Warning" />
|
||||
<Rule Id="S2996" Action="Warning" />
|
||||
<Rule Id="S2997" Action="Warning" />
|
||||
<Rule Id="S3005" Action="Warning" />
|
||||
<Rule Id="S3010" Action="Warning" />
|
||||
<Rule Id="S3052" Action="None" />
|
||||
<Rule Id="S3060" Action="Warning" />
|
||||
<Rule Id="S3168" Action="Warning" />
|
||||
<Rule Id="S3169" Action="Warning" />
|
||||
<Rule Id="S3172" Action="Warning" />
|
||||
<Rule Id="S3215" Action="None" />
|
||||
<Rule Id="S3216" Action="None" />
|
||||
<Rule Id="S3217" Action="Warning" />
|
||||
<Rule Id="S3218" Action="Warning" />
|
||||
<Rule Id="S3220" Action="Warning" />
|
||||
<Rule Id="S3234" Action="None" />
|
||||
<Rule Id="S3235" Action="None" />
|
||||
<Rule Id="S3236" Action="Warning" />
|
||||
<Rule Id="S3237" Action="Warning" />
|
||||
<Rule Id="S3240" Action="None" />
|
||||
<Rule Id="S3241" Action="Warning" />
|
||||
<Rule Id="S3242" Action="None" />
|
||||
<Rule Id="S3244" Action="Warning" />
|
||||
<Rule Id="S3246" Action="Warning" />
|
||||
<Rule Id="S3247" Action="Warning" />
|
||||
<Rule Id="S3249" Action="Warning" />
|
||||
<Rule Id="S3251" Action="Warning" />
|
||||
<Rule Id="S3253" Action="None" />
|
||||
<Rule Id="S3254" Action="None" />
|
||||
<Rule Id="S3256" Action="Warning" />
|
||||
<Rule Id="S3257" Action="None" />
|
||||
<Rule Id="S3261" Action="Warning" />
|
||||
<Rule Id="S3262" Action="Warning" />
|
||||
<Rule Id="S3263" Action="Warning" />
|
||||
<Rule Id="S3264" Action="Warning" />
|
||||
<Rule Id="S3265" Action="Warning" />
|
||||
<Rule Id="S3330" Action="None" />
|
||||
<Rule Id="S3343" Action="Warning" />
|
||||
<Rule Id="S3346" Action="Warning" />
|
||||
<Rule Id="S3353" Action="None" />
|
||||
<Rule Id="S3358" Action="Warning" />
|
||||
<Rule Id="S3366" Action="None" />
|
||||
<Rule Id="S3376" Action="Warning" />
|
||||
<Rule Id="S3397" Action="Warning" />
|
||||
<Rule Id="S3400" Action="Warning" />
|
||||
<Rule Id="S3415" Action="Warning" />
|
||||
<Rule Id="S3427" Action="Warning" />
|
||||
<Rule Id="S3431" Action="None" />
|
||||
<Rule Id="S3433" Action="Warning" />
|
||||
<Rule Id="S3440" Action="Warning" />
|
||||
<Rule Id="S3441" Action="None" />
|
||||
<Rule Id="S3442" Action="Warning" />
|
||||
<Rule Id="S3443" Action="Warning" />
|
||||
<Rule Id="S3444" Action="Warning" />
|
||||
<Rule Id="S3445" Action="Warning" />
|
||||
<Rule Id="S3447" Action="Warning" />
|
||||
<Rule Id="S3449" Action="Warning" />
|
||||
<Rule Id="S3450" Action="Warning" />
|
||||
<Rule Id="S3451" Action="Warning" />
|
||||
<Rule Id="S3453" Action="Warning" />
|
||||
<Rule Id="S3456" Action="Warning" />
|
||||
<Rule Id="S3457" Action="Warning" />
|
||||
<Rule Id="S3458" Action="Warning" />
|
||||
<Rule Id="S3459" Action="Warning" />
|
||||
<Rule Id="S3464" Action="Warning" />
|
||||
<Rule Id="S3466" Action="Warning" />
|
||||
<Rule Id="S3532" Action="None" />
|
||||
<Rule Id="S3597" Action="Warning" />
|
||||
<Rule Id="S3598" Action="Warning" />
|
||||
<Rule Id="S3600" Action="Warning" />
|
||||
<Rule Id="S3603" Action="Warning" />
|
||||
<Rule Id="S3604" Action="Warning" />
|
||||
<Rule Id="S3610" Action="Warning" />
|
||||
<Rule Id="S3626" Action="Warning" />
|
||||
<Rule Id="S3655" Action="Warning" />
|
||||
<Rule Id="S3693" Action="Warning" />
|
||||
<Rule Id="S3717" Action="None" />
|
||||
<Rule Id="S3776" Action="Warning" />
|
||||
<Rule Id="S3869" Action="Warning" />
|
||||
<Rule Id="S3871" Action="Warning" />
|
||||
<Rule Id="S3872" Action="None" />
|
||||
<Rule Id="S3874" Action="None" />
|
||||
<Rule Id="S3875" Action="Warning" />
|
||||
<Rule Id="S3876" Action="None" />
|
||||
<Rule Id="S3877" Action="Warning" />
|
||||
<Rule Id="S3880" Action="None" />
|
||||
<Rule Id="S3881" Action="Warning" />
|
||||
<Rule Id="S3884" Action="Warning" />
|
||||
<Rule Id="S3885" Action="Warning" />
|
||||
<Rule Id="S3887" Action="Warning" />
|
||||
<Rule Id="S3889" Action="Warning" />
|
||||
<Rule Id="S3897" Action="Warning" />
|
||||
<Rule Id="S3898" Action="None" />
|
||||
<Rule Id="S3900" Action="None" />
|
||||
<Rule Id="S3902" Action="None" />
|
||||
<Rule Id="S3903" Action="Warning" />
|
||||
<Rule Id="S3904" Action="Warning" />
|
||||
<Rule Id="S3906" Action="None" />
|
||||
<Rule Id="S3908" Action="None" />
|
||||
<Rule Id="S3909" Action="None" />
|
||||
<Rule Id="S3923" Action="Warning" />
|
||||
<Rule Id="S3925" Action="Warning" />
|
||||
<Rule Id="S3926" Action="Warning" />
|
||||
<Rule Id="S3927" Action="Warning" />
|
||||
<Rule Id="S3928" Action="Warning" />
|
||||
<Rule Id="S3937" Action="None" />
|
||||
<Rule Id="S3956" Action="None" />
|
||||
<Rule Id="S3962" Action="None" />
|
||||
<Rule Id="S3963" Action="Warning" />
|
||||
<Rule Id="S3966" Action="Warning" />
|
||||
<Rule Id="S3967" Action="None" />
|
||||
<Rule Id="S3971" Action="Warning" />
|
||||
<Rule Id="S3972" Action="Warning" />
|
||||
<Rule Id="S3973" Action="Warning" />
|
||||
<Rule Id="S3981" Action="Warning" />
|
||||
<Rule Id="S3984" Action="Warning" />
|
||||
<Rule Id="S3990" Action="None" />
|
||||
<Rule Id="S3992" Action="None" />
|
||||
<Rule Id="S3993" Action="None" />
|
||||
<Rule Id="S3994" Action="None" />
|
||||
<Rule Id="S3995" Action="None" />
|
||||
<Rule Id="S3996" Action="None" />
|
||||
<Rule Id="S3997" Action="None" />
|
||||
<Rule Id="S3998" Action="Warning" />
|
||||
<Rule Id="S4000" Action="None" />
|
||||
<Rule Id="S4002" Action="None" />
|
||||
<Rule Id="S4004" Action="None" />
|
||||
<Rule Id="S4005" Action="None" />
|
||||
<Rule Id="S4015" Action="Warning" />
|
||||
<Rule Id="S4016" Action="Warning" />
|
||||
<Rule Id="S4017" Action="None" />
|
||||
<Rule Id="S4018" Action="None" />
|
||||
<Rule Id="S4019" Action="Warning" />
|
||||
<Rule Id="S4022" Action="None" />
|
||||
<Rule Id="S4023" Action="None" />
|
||||
<Rule Id="S4025" Action="None" />
|
||||
<Rule Id="S4026" Action="None" />
|
||||
<Rule Id="S4027" Action="None" />
|
||||
<Rule Id="S4035" Action="Warning" />
|
||||
<Rule Id="S4039" Action="None" />
|
||||
<Rule Id="S4040" Action="None" />
|
||||
<Rule Id="S4041" Action="None" />
|
||||
<Rule Id="S4047" Action="None" />
|
||||
<Rule Id="S4049" Action="None" />
|
||||
<Rule Id="S4050" Action="None" />
|
||||
<Rule Id="S4052" Action="None" />
|
||||
<Rule Id="S4055" Action="None" />
|
||||
<Rule Id="S4056" Action="None" />
|
||||
<Rule Id="S4057" Action="None" />
|
||||
<Rule Id="S4058" Action="None" />
|
||||
<Rule Id="S4059" Action="None" />
|
||||
<Rule Id="S4060" Action="None" />
|
||||
<Rule Id="S4061" Action="Warning" />
|
||||
<Rule Id="S4069" Action="None" />
|
||||
<Rule Id="S4070" Action="None" />
|
||||
<Rule Id="S4142" Action="None" />
|
||||
<Rule Id="S4143" Action="Warning" />
|
||||
<Rule Id="S4144" Action="Warning" />
|
||||
<Rule Id="S4158" Action="Warning" />
|
||||
<Rule Id="S4159" Action="Warning" />
|
||||
<Rule Id="S4200" Action="Warning" />
|
||||
<Rule Id="S4210" Action="Warning" />
|
||||
<Rule Id="S4211" Action="Warning" />
|
||||
<Rule Id="S4212" Action="None" />
|
||||
<Rule Id="S4214" Action="Warning" />
|
||||
<Rule Id="S4220" Action="Warning" />
|
||||
<Rule Id="S4225" Action="None" />
|
||||
<Rule Id="S4226" Action="None" />
|
||||
<Rule Id="S4260" Action="Warning" />
|
||||
<Rule Id="S4261" Action="None" />
|
||||
<Rule Id="S4275" Action="Warning" />
|
||||
<Rule Id="S4277" Action="Warning" />
|
||||
<Rule Id="S4426" Action="Warning" />
|
||||
<Rule Id="S4428" Action="Warning" />
|
||||
<Rule Id="S4432" Action="None" />
|
||||
<Rule Id="S4433" Action="Warning" />
|
||||
<Rule Id="S4456" Action="Warning" />
|
||||
<Rule Id="S4457" Action="Warning" />
|
||||
<Rule Id="S4462" Action="None" />
|
||||
<Rule Id="S4524" Action="Warning" />
|
||||
<Rule Id="S4564" Action="None" />
|
||||
<Rule Id="S4581" Action="Warning" />
|
||||
<Rule Id="S4586" Action="Warning" />
|
||||
<Rule Id="S818" Action="Warning" />
|
||||
<Rule Id="S881" Action="None" />
|
||||
<Rule Id="S907" Action="Warning" />
|
||||
<Rule Id="S927" Action="Warning" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="SonarAnalyzer.Security" RuleNamespace="SonarAnalyzer.Security">
|
||||
<Rule Id="S2076" Action="Warning" />
|
||||
<Rule Id="S2078" Action="Warning" />
|
||||
<Rule Id="S2083" Action="Warning" />
|
||||
<Rule Id="S2091" Action="Warning" />
|
||||
<Rule Id="S2631" Action="Warning" />
|
||||
<Rule Id="S3649" Action="Warning" />
|
||||
</Rules>
|
||||
</RuleSet>
|
||||
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,3 +1,16 @@
|
||||
# 1.5.60 (09 July 2024)
|
||||
- [#1128](https://github.com/WireMock-Net/WireMock.Net/pull/1128) - Add Handlebars.Net.Helpers.Xslt [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1130](https://github.com/WireMock-Net/WireMock.Net/pull/1130) - Add AdminPath to WireMockServerSettings [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1131](https://github.com/WireMock-Net/WireMock.Net/pull/1131) - Add unit tests for AdminApiMappingBuilder [test] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1132](https://github.com/WireMock-Net/WireMock.Net/pull/1132) - Multipart Matcher Fix [bug] contributed by [rmeshksar](https://github.com/rmeshksar)
|
||||
- [#1133](https://github.com/WireMock-Net/WireMock.Net/pull/1133) - Add unit tests for AdminApiMappingBuilder_ [test] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1134](https://github.com/WireMock-Net/WireMock.Net/pull/1134) - Remove some files and folders [refactor] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1119](https://github.com/WireMock-Net/WireMock.Net/issues/1119) - Error in RequestMessageMultiPartMatcher [bug]
|
||||
- [#1121](https://github.com/WireMock-Net/WireMock.Net/issues/1121) - XML transformation [feature]
|
||||
|
||||
# 1.5.59 (26 June 2024)
|
||||
- [#1127](https://github.com/WireMock-Net/WireMock.Net/pull/1127) - Made changes to accommodate breaking change in testcontainers-dotnet 3.9 [feature] contributed by [epDugas](https://github.com/epDugas)
|
||||
|
||||
# 1.5.58 (08 June 2024)
|
||||
- [#1116](https://github.com/WireMock-Net/WireMock.Net/pull/1116) - Add some methods to the BodyModelBuilder [feature] contributed by [StefH](https://github.com/StefH)
|
||||
- [#1117](https://github.com/WireMock-Net/WireMock.Net/issues/1117) - AbstractJsonPartialMatcher: Regex Value is Uppercased when IgnoreCase is set to true [bug]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.5.58</VersionPrefix>
|
||||
<VersionPrefix>1.5.60</VersionPrefix>
|
||||
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
||||
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
rem https://github.com/StefH/GitHubReleaseNotes
|
||||
|
||||
SET version=1.5.58
|
||||
SET version=1.5.60
|
||||
|
||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate example --version %version% --token %GH_TOKEN%
|
||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate example environment --version %version% --token %GH_TOKEN%
|
||||
|
||||
GitHubReleaseNotes --output PackageReleaseNotes.txt --skip-empty-releases --exclude-labels question invalid doc duplicate --template PackageReleaseNotes.template --version %version% --token %GH_TOKEN%
|
||||
GitHubReleaseNotes --output PackageReleaseNotes.txt --skip-empty-releases --exclude-labels question invalid doc duplicate example environment --template PackageReleaseNotes.template --version %version% --token %GH_TOKEN%
|
||||
@@ -1,5 +1,11 @@
|
||||
# 1.5.58 (08 June 2024)
|
||||
- #1116 Add some methods to the BodyModelBuilder [feature]
|
||||
- #1117 AbstractJsonPartialMatcher: Regex Value is Uppercased when IgnoreCase is set to true [bug]
|
||||
# 1.5.60 (09 July 2024)
|
||||
- #1128 Add Handlebars.Net.Helpers.Xslt [feature]
|
||||
- #1130 Add AdminPath to WireMockServerSettings [feature]
|
||||
- #1131 Add unit tests for AdminApiMappingBuilder [test]
|
||||
- #1132 Multipart Matcher Fix [bug]
|
||||
- #1133 Add unit tests for AdminApiMappingBuilder_ [test]
|
||||
- #1134 Remove some files and folders [refactor]
|
||||
- #1119 Error in RequestMessageMultiPartMatcher [bug]
|
||||
- #1121 XML transformation [feature]
|
||||
|
||||
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
||||
@@ -27,7 +27,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
Directory.Build.props = Directory.Build.props
|
||||
.github\FUNDING.yml = .github\FUNDING.yml
|
||||
Generate-ReleaseNotes.cmd = Generate-ReleaseNotes.cmd
|
||||
nuget.config = nuget.config
|
||||
PackageReadme.md = PackageReadme.md
|
||||
PackageReleaseNotes.template = PackageReleaseNotes.template
|
||||
PackageReleaseNotes.txt = PackageReleaseNotes.txt
|
||||
@@ -70,7 +69,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.Net472
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Actions", "Actions", "{1DAEFF47-D117-4E95-8B3E-4F7C8B92011A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\System.Linq.Dynamic.Core\.github\workflows\ci.yml = ..\System.Linq.Dynamic.Core\.github\workflows\ci.yml
|
||||
.github\workflows\ci.yml = .github\workflows\ci.yml
|
||||
.github\workflows\CreateRelease.yml = .github\workflows\CreateRelease.yml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
@@ -106,7 +105,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{0147029F
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultipartUploader", "tools\MultipartUploader\MultipartUploader.csproj", "{07C30227-ADEC-4BDE-8CDC-849D85A690BB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.NET7.UsingNuGet", "examples\WireMock.Net.Console.NET7.UsingNuGet\WireMock.Net.Console.NET7.UsingNuGet.csproj", "{941229D6-191B-4B5E-AC81-0905EBF4F19D}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NET7.UsingNuGet", "examples\WireMock.Net.Console.NET7.UsingNuGet\WireMock.Net.Console.NET7.UsingNuGet.csproj", "{941229D6-191B-4B5E-AC81-0905EBF4F19D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NET8", "examples\WireMock.Net.Console.NET8\WireMock.Net.Console.NET8.csproj", "{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}"
|
||||
EndProject
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
pool:
|
||||
vmImage: 'Ubuntu-latest'
|
||||
|
||||
variables:
|
||||
buildConfiguration: 'Release'
|
||||
|
||||
steps:
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 8'
|
||||
inputs:
|
||||
packageType: sdk
|
||||
version: 8.0.x
|
||||
|
||||
- script: |
|
||||
dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --configuration $(buildConfiguration) --framework net8.0 --logger trx
|
||||
displayName: 'Test'
|
||||
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: VSTest
|
||||
testResultsFiles: '**/*.trx'
|
||||
@@ -14,53 +14,45 @@ jobs:
|
||||
echo "BuildId = $(buildId)"
|
||||
displayName: 'Print buildId'
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: Use .NET 8.0
|
||||
inputs:
|
||||
packageType: 'sdk'
|
||||
version: '8.0.x'
|
||||
- script: |
|
||||
dotnet tool install --global dotnet-sonarscanner
|
||||
dotnet tool install --global dotnet-coverage
|
||||
dotnet tool install --global coverlet.console
|
||||
displayName: 'Install dotnet tools'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: "Use JDK11 by default"
|
||||
displayName: "Use JDK17 by default"
|
||||
inputs:
|
||||
targetType: 'inline'
|
||||
script: |
|
||||
$jdkPath = $env:JAVA_HOME_11_X64
|
||||
$jdkPath = $env:JAVA_HOME_17_X64
|
||||
Write-Host "##vso[task.setvariable variable=JAVA_HOME]$jdkPath"
|
||||
|
||||
- script: |
|
||||
dotnet dev-certs https --trust || true
|
||||
displayName: 'dotnet dev-certs https'
|
||||
|
||||
- task: SonarCloudPrepare@1
|
||||
displayName: 'Prepare analysis on SonarCloud'
|
||||
|
||||
# See: https://docs.sonarsource.com/sonarcloud/enriching/test-coverage/dotnet-test-coverage
|
||||
- script: |
|
||||
dotnet sonarscanner begin /k:"WireMock-Net_WireMock.Net" /o:"wiremock-net" /d:sonar.branch.name=$(Build.SourceBranchName) /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="$(SONAR_TOKEN)" /d:sonar.dotnet.excludeTestProjects=true /d:sonar.cs.vscoveragexml.reportsPaths=**/wiremock-coverage.xml /d:sonar.verbose=true
|
||||
displayName: 'Begin analysis on SonarCloud'
|
||||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
|
||||
inputs:
|
||||
SonarCloud: SonarCloud
|
||||
organization: wiremock-net
|
||||
projectKey: 'WireMock-Net_WireMock.Net'
|
||||
projectName: 'WireMock.Net'
|
||||
extraProperties: |
|
||||
sonar.cs.opencover.reportsPaths=**/coverage.net8.0.opencover.xml
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Build Unit tests'
|
||||
inputs:
|
||||
command: 'build'
|
||||
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
|
||||
arguments: '--configuration Debug --framework net8.0'
|
||||
arguments: '--configuration Debug --framework net8.0 --no-incremental'
|
||||
|
||||
- task: CmdLine@2
|
||||
inputs:
|
||||
script: 'dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net8.0'
|
||||
script: 'dotnet-coverage collect "dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --configuration Debug --no-build --framework net8.0" -f xml -o "wiremock-coverage.xml"'
|
||||
displayName: 'Execute Unit Tests with Coverage'
|
||||
|
||||
- task: SonarCloudAnalyze@1
|
||||
displayName: 'SonarCloud: Run Code Analysis'
|
||||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
|
||||
|
||||
- task: SonarCloudPublish@1
|
||||
displayName: 'SonarCloud: Publish Quality Gate Result'
|
||||
- script: |
|
||||
dotnet sonarscanner end /d:sonar.token="$(SONAR_TOKEN)"
|
||||
displayName: 'End analysis on SonarCloud'
|
||||
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) # Do not run for PullRequests
|
||||
|
||||
- task: whitesource.ws-bolt.bolt.wss.WhiteSource Bolt@19
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
trigger:
|
||||
- none
|
||||
|
||||
pool:
|
||||
vmImage: 'Ubuntu-latest'
|
||||
|
||||
variables:
|
||||
buildProjects: '**/src/**/*.csproj'
|
||||
buildConfiguration: 'Release'
|
||||
|
||||
steps:
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 8'
|
||||
inputs:
|
||||
packageType: sdk
|
||||
version: 8.0.x
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: Build Release
|
||||
inputs:
|
||||
command: 'build'
|
||||
arguments: /p:Configuration=$(buildConfiguration)
|
||||
projects: $(buildProjects)
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish Artifacts
|
||||
condition: succeeded()
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
6907
report/coverage.info
6907
report/coverage.info
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
||||
dotnet test ..\test\WireMock.Net.Tests\WireMock.Net.Tests.csproj -c Debug -f netcoreapp2.1 /p:CollectCoverage=true /p:CoverletOutputFormat=\"opencover,lcov\" /p:CoverletOutput="../../report/"
|
||||
|
||||
%USERPROFILE%\.nuget\packages\ReportGenerator\3.1.2\tools\ReportGenerator.exe -reports:"coverage.opencover.xml" -targetdir:"coverlet"
|
||||
|
||||
start coverlet\index.htm
|
||||
@@ -29,7 +29,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Stef.Validation" Version="0.1.1" />
|
||||
<PackageReference Include="Testcontainers" Version="[3.7.0]" />
|
||||
<PackageReference Include="Testcontainers" Version="[3.9.0]" />
|
||||
<PackageReference Include="JetBrains.Annotations" VersionOverride="2022.3.1" PrivateAssets="All" Version="2023.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using DotNet.Testcontainers.Containers;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using RestEase;
|
||||
using Stef.Validation;
|
||||
using WireMock.Client;
|
||||
@@ -26,8 +25,7 @@ public sealed class WireMockContainer : DockerContainer
|
||||
/// Initializes a new instance of the <see cref="WireMockContainer" /> class.
|
||||
/// </summary>
|
||||
/// <param name="configuration">The container configuration.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public WireMockContainer(WireMockConfiguration configuration, ILogger logger) : base(configuration, logger)
|
||||
public WireMockContainer(WireMockConfiguration configuration) : base(configuration)
|
||||
{
|
||||
_configuration = Guard.NotNull(configuration);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public sealed class WireMockContainerBuilder : ContainerBuilder<WireMockContaine
|
||||
{
|
||||
Validate();
|
||||
|
||||
return new WireMockContainer(DockerResourceConfiguration, TestcontainersSettings.Logger);
|
||||
return new WireMockContainer(DockerResourceConfiguration);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -71,23 +71,21 @@ public class RequestMessageMultiPartMatcher : IRequestMatcher
|
||||
{
|
||||
var mimePartMatchers = Matchers.OfType<MimePartMatcher>().ToArray();
|
||||
|
||||
foreach (var mimePart in message.BodyParts.OfType<MimeKit.MimePart>())
|
||||
foreach (var mimePartMatcher in Matchers.OfType<MimePartMatcher>().ToArray())
|
||||
{
|
||||
var matchesForMimePart = new List<MatchResult> { default };
|
||||
matchesForMimePart.AddRange(mimePartMatchers.Select(matcher => matcher.IsMatch(mimePart)));
|
||||
|
||||
score = matchesForMimePart.Select(m => m.Score).Max();
|
||||
|
||||
if (MatchScores.IsPerfect(score))
|
||||
score = MatchScores.Mismatch;
|
||||
foreach (var mimeBodyPart in message.BodyParts.OfType<MimeKit.MimePart>())
|
||||
{
|
||||
if (MatchOperator == MatchOperator.Or)
|
||||
var matchResult = mimePartMatcher.IsMatch(mimeBodyPart);
|
||||
if (matchResult.IsPerfect())
|
||||
{
|
||||
score = MatchScores.Perfect;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((MatchOperator == MatchOperator.Or && MatchScores.IsPerfect(score))
|
||||
|| (MatchOperator == MatchOperator.And && !MatchScores.IsPerfect(score)))
|
||||
{
|
||||
score = MatchScores.Mismatch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseProviders;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
|
||||
@@ -30,100 +31,116 @@ namespace WireMock.Server;
|
||||
public partial class WireMockServer
|
||||
{
|
||||
private const int EnhancedFileSystemWatcherTimeoutMs = 1000;
|
||||
private const string AdminFiles = "/__admin/files";
|
||||
private const string AdminHealth = "/__admin/health";
|
||||
private const string AdminMappings = "/__admin/mappings";
|
||||
private const string AdminMappingsCode = "/__admin/mappings/code";
|
||||
private const string AdminMappingsWireMockOrg = "/__admin/mappings/wiremock.org";
|
||||
private const string AdminRequests = "/__admin/requests";
|
||||
private const string AdminSettings = "/__admin/settings";
|
||||
private const string AdminScenarios = "/__admin/scenarios";
|
||||
private const string AdminOpenApi = "/__admin/openapi";
|
||||
|
||||
private const string DefaultAdminPathPrefix = "/__admin";
|
||||
private const string QueryParamReloadStaticMappings = "reloadStaticMappings";
|
||||
|
||||
private static readonly Guid ProxyMappingGuid = new("e59914fd-782e-428e-91c1-4810ffb86567");
|
||||
private static readonly RegexMatcher AdminRequestContentTypeJson = new ContentTypeMatcher(WireMockConstants.ContentTypeJson, true);
|
||||
private static readonly RegexMatcher AdminMappingsGuidPathMatcher = new(@"^\/__admin\/mappings\/([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$");
|
||||
private static readonly RegexMatcher AdminMappingsCodeGuidPathMatcher = new(@"^\/__admin\/mappings\/code\/([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$");
|
||||
private static readonly RegexMatcher AdminRequestsGuidPathMatcher = new(@"^\/__admin\/requests\/([0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12})$");
|
||||
private static readonly RegexMatcher AdminScenariosNameMatcher = new(@"^\/__admin\/scenarios\/.+$");
|
||||
private static readonly RegexMatcher AdminScenariosNameWithResetMatcher = new(@"^\/__admin\/scenarios\/.+\/reset$");
|
||||
|
||||
private EnhancedFileSystemWatcher? _enhancedFileSystemWatcher;
|
||||
private AdminPaths? _adminPaths;
|
||||
|
||||
private sealed class AdminPaths
|
||||
{
|
||||
private readonly string _prefix;
|
||||
private readonly string _prefixEscaped;
|
||||
|
||||
public AdminPaths(WireMockServerSettings settings)
|
||||
{
|
||||
_prefix = settings.AdminPath ?? DefaultAdminPathPrefix;
|
||||
_prefixEscaped = _prefix.Replace("/", "\\/");
|
||||
}
|
||||
|
||||
public string Files => $"{_prefix}/files";
|
||||
public string Health => $"{_prefix}/health";
|
||||
public string Mappings => $"{_prefix}/mappings";
|
||||
public string MappingsCode => $"{_prefix}/mappings/code";
|
||||
public string MappingsWireMockOrg => $"{_prefix}mappings/wiremock.org";
|
||||
public string Requests => $"{_prefix}/requests";
|
||||
public string Settings => $"{_prefix}/settings";
|
||||
public string Scenarios => $"{_prefix}/scenarios";
|
||||
public string OpenApi => $"{_prefix}/openapi";
|
||||
|
||||
public RegexMatcher MappingsGuidPathMatcher => new($"^{_prefixEscaped}\\/mappings\\/([0-9A-Fa-f]{{8}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{12}})$");
|
||||
public RegexMatcher MappingsCodeGuidPathMatcher => new($"^{_prefixEscaped}\\/mappings\\/code\\/([0-9A-Fa-f]{{8}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{12}})$");
|
||||
public RegexMatcher RequestsGuidPathMatcher => new($"^{_prefixEscaped}\\/requests\\/([0-9A-Fa-f]{{8}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{4}}[-][0-9A-Fa-f]{{12}})$");
|
||||
public RegexMatcher ScenariosNameMatcher => new($"^{_prefixEscaped}\\/scenarios\\/.+$");
|
||||
public RegexMatcher ScenariosNameWithResetMatcher => new($"^{_prefixEscaped}\\/scenarios\\/.+\\/reset$");
|
||||
public RegexMatcher FilesFilenamePathMatcher => new($"^{_prefixEscaped}\\/files\\/.+$");
|
||||
}
|
||||
|
||||
#region InitAdmin
|
||||
private void InitAdmin()
|
||||
{
|
||||
_adminPaths = new AdminPaths(_settings);
|
||||
|
||||
// __admin/health
|
||||
Given(Request.Create().WithPath(AdminHealth).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(HealthGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.Health).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(HealthGet));
|
||||
|
||||
// __admin/settings
|
||||
Given(Request.Create().WithPath(AdminSettings).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(SettingsGet));
|
||||
Given(Request.Create().WithPath(AdminSettings).UsingMethod("PUT", "POST").WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(SettingsUpdate));
|
||||
Given(Request.Create().WithPath(_adminPaths.Settings).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(SettingsGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.Settings).UsingMethod("PUT", "POST").WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(SettingsUpdate));
|
||||
|
||||
// __admin/mappings
|
||||
Given(Request.Create().WithPath(AdminMappings).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsGet));
|
||||
Given(Request.Create().WithPath(AdminMappings).UsingPost().WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsPost));
|
||||
Given(Request.Create().WithPath(AdminMappings).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsDelete));
|
||||
Given(Request.Create().WithPath(_adminPaths.Mappings).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.Mappings).UsingPost().WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsPost));
|
||||
Given(Request.Create().WithPath(_adminPaths.Mappings).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsDelete));
|
||||
|
||||
// __admin/mappings/code
|
||||
Given(Request.Create().WithPath(AdminMappingsCode).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsCodeGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.MappingsCode).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsCodeGet));
|
||||
|
||||
// __admin/mappings/wiremock.org
|
||||
Given(Request.Create().WithPath(AdminMappingsWireMockOrg).UsingPost().WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsPostWireMockOrg));
|
||||
Given(Request.Create().WithPath(_adminPaths.MappingsWireMockOrg).UsingPost().WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsPostWireMockOrg));
|
||||
|
||||
// __admin/mappings/reset
|
||||
Given(Request.Create().WithPath(AdminMappings + "/reset").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsReset));
|
||||
Given(Request.Create().WithPath(_adminPaths.Mappings + "/reset").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsReset));
|
||||
|
||||
// __admin/mappings/{guid}
|
||||
Given(Request.Create().WithPath(AdminMappingsGuidPathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingGet));
|
||||
Given(Request.Create().WithPath(AdminMappingsGuidPathMatcher).UsingPut().WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingPut));
|
||||
Given(Request.Create().WithPath(AdminMappingsGuidPathMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingDelete));
|
||||
Given(Request.Create().WithPath(_adminPaths.MappingsGuidPathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.MappingsGuidPathMatcher).UsingPut().WithHeader(HttpKnownHeaderNames.ContentType, AdminRequestContentTypeJson)).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingPut));
|
||||
Given(Request.Create().WithPath(_adminPaths.MappingsGuidPathMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingDelete));
|
||||
|
||||
// __admin/mappings/code/{guid}
|
||||
Given(Request.Create().WithPath(AdminMappingsCodeGuidPathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingCodeGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.MappingsCodeGuidPathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingCodeGet));
|
||||
|
||||
// __admin/mappings/save
|
||||
Given(Request.Create().WithPath($"{AdminMappings}/save").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsSave));
|
||||
Given(Request.Create().WithPath($"{_adminPaths.Mappings}/save").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(MappingsSave));
|
||||
|
||||
// __admin/mappings/swagger
|
||||
Given(Request.Create().WithPath($"{AdminMappings}/swagger").UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(SwaggerGet));
|
||||
Given(Request.Create().WithPath($"{_adminPaths.Mappings}/swagger").UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(SwaggerGet));
|
||||
|
||||
// __admin/requests
|
||||
Given(Request.Create().WithPath(AdminRequests).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsGet));
|
||||
Given(Request.Create().WithPath(AdminRequests).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsDelete));
|
||||
Given(Request.Create().WithPath(_adminPaths.Requests).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.Requests).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsDelete));
|
||||
|
||||
// __admin/requests/reset
|
||||
Given(Request.Create().WithPath(AdminRequests + "/reset").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsDelete));
|
||||
Given(Request.Create().WithPath(_adminPaths.Requests + "/reset").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsDelete));
|
||||
|
||||
// __admin/request/{guid}
|
||||
Given(Request.Create().WithPath(AdminRequestsGuidPathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestGet));
|
||||
Given(Request.Create().WithPath(AdminRequestsGuidPathMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestDelete));
|
||||
Given(Request.Create().WithPath(_adminPaths.RequestsGuidPathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.RequestsGuidPathMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestDelete));
|
||||
|
||||
// __admin/requests/find
|
||||
Given(Request.Create().WithPath(AdminRequests + "/find").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsFind));
|
||||
Given(Request.Create().WithPath(AdminRequests + "/find").UsingGet().WithParam("mappingGuid", new NotNullOrEmptyMatcher())).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsFindByMappingGuid));
|
||||
Given(Request.Create().WithPath(_adminPaths.Requests + "/find").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsFind));
|
||||
Given(Request.Create().WithPath(_adminPaths.Requests + "/find").UsingGet().WithParam("mappingGuid", new NotNullOrEmptyMatcher())).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(RequestsFindByMappingGuid));
|
||||
|
||||
// __admin/scenarios
|
||||
Given(Request.Create().WithPath(AdminScenarios).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenariosGet));
|
||||
Given(Request.Create().WithPath(AdminScenarios).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenariosReset));
|
||||
Given(Request.Create().WithPath(AdminScenariosNameMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenarioReset));
|
||||
Given(Request.Create().WithPath(_adminPaths.Scenarios).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenariosGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.Scenarios).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenariosReset));
|
||||
Given(Request.Create().WithPath(_adminPaths.ScenariosNameMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenarioReset));
|
||||
|
||||
// __admin/scenarios/reset
|
||||
Given(Request.Create().WithPath(AdminScenarios + "/reset").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenariosReset));
|
||||
Given(Request.Create().WithPath(AdminScenariosNameWithResetMatcher).UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenarioReset));
|
||||
Given(Request.Create().WithPath(_adminPaths.Scenarios + "/reset").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenariosReset));
|
||||
Given(Request.Create().WithPath(_adminPaths.ScenariosNameWithResetMatcher).UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(ScenarioReset));
|
||||
|
||||
// __admin/files/{filename}
|
||||
Given(Request.Create().WithPath(AdminFilesFilenamePathMatcher).UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FilePost));
|
||||
Given(Request.Create().WithPath(AdminFilesFilenamePathMatcher).UsingPut()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FilePut));
|
||||
Given(Request.Create().WithPath(AdminFilesFilenamePathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FileGet));
|
||||
Given(Request.Create().WithPath(AdminFilesFilenamePathMatcher).UsingHead()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FileHead));
|
||||
Given(Request.Create().WithPath(AdminFilesFilenamePathMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FileDelete));
|
||||
Given(Request.Create().WithPath(_adminPaths.FilesFilenamePathMatcher).UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FilePost));
|
||||
Given(Request.Create().WithPath(_adminPaths.FilesFilenamePathMatcher).UsingPut()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FilePut));
|
||||
Given(Request.Create().WithPath(_adminPaths.FilesFilenamePathMatcher).UsingGet()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FileGet));
|
||||
Given(Request.Create().WithPath(_adminPaths.FilesFilenamePathMatcher).UsingHead()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FileHead));
|
||||
Given(Request.Create().WithPath(_adminPaths.FilesFilenamePathMatcher).UsingDelete()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(FileDelete));
|
||||
|
||||
// __admin/openapi
|
||||
Given(Request.Create().WithPath($"{AdminOpenApi}/convert").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(OpenApiConvertToMappings));
|
||||
Given(Request.Create().WithPath($"{AdminOpenApi}/save").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(OpenApiSaveToMappings));
|
||||
Given(Request.Create().WithPath($"{_adminPaths.OpenApi}/convert").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(OpenApiConvertToMappings));
|
||||
Given(Request.Create().WithPath($"{_adminPaths.OpenApi}/save").UsingPost()).AtPriority(WireMockConstants.AdminPriority).RespondWith(new DynamicResponseProvider(OpenApiSaveToMappings));
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -665,7 +682,7 @@ public partial class WireMockServer
|
||||
private IResponseMessage ScenarioReset(IRequestMessage requestMessage)
|
||||
{
|
||||
var name = string.Equals(HttpRequestMethod.DELETE, requestMessage.Method, StringComparison.OrdinalIgnoreCase) ?
|
||||
requestMessage.Path.Substring(AdminScenarios.Length + 1) :
|
||||
requestMessage.Path.Substring(_adminPaths!.Scenarios.Length + 1) :
|
||||
requestMessage.Path.Split('/').Reverse().Skip(1).First();
|
||||
|
||||
return ResetScenario(name) ?
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Types;
|
||||
using WireMock.Util;
|
||||
|
||||
@@ -10,7 +9,6 @@ namespace WireMock.Server;
|
||||
|
||||
public partial class WireMockServer
|
||||
{
|
||||
private static readonly RegexMatcher AdminFilesFilenamePathMatcher = new(@"^\/__admin\/files\/.*$");
|
||||
private static readonly Encoding[] FileBodyIsString = { Encoding.UTF8, Encoding.ASCII };
|
||||
|
||||
#region Files/{filename}
|
||||
@@ -117,9 +115,9 @@ public partial class WireMockServer
|
||||
return ResponseMessageBuilder.Create(HttpStatusCode.OK, "File deleted.");
|
||||
}
|
||||
|
||||
private static string GetFileNameFromRequestMessage(IRequestMessage requestMessage)
|
||||
private string GetFileNameFromRequestMessage(IRequestMessage requestMessage)
|
||||
{
|
||||
return Path.GetFileName(requestMessage.Path.Substring(AdminFiles.Length + 1));
|
||||
return Path.GetFileName(requestMessage.Path.Substring(_adminPaths!.Files.Length + 1));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -245,16 +245,16 @@ public class WireMockServerSettings
|
||||
public bool CustomCertificateDefined => CertificateSettings?.IsDefined == true;
|
||||
|
||||
#if USE_ASPNETCORE
|
||||
/// <summary>
|
||||
/// Client certificate mode for the server
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public ClientCertificateMode ClientCertificateMode { get; set; }
|
||||
/// <summary>
|
||||
/// Client certificate mode for the server
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public ClientCertificateMode ClientCertificateMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to accept any client certificate
|
||||
/// </summary>
|
||||
public bool AcceptAnyClientCertificate { get; set; }
|
||||
/// <summary>
|
||||
/// Whether to accept any client certificate
|
||||
/// </summary>
|
||||
public bool AcceptAnyClientCertificate { get; set; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -320,4 +320,11 @@ public class WireMockServerSettings
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public Dictionary<string, GraphQLSchemaDetails>? GraphQLSchemas { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The admin path to use for accessing the Admin REST interface.
|
||||
/// If not set <c>__/admin</c> is used.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public string? AdminPath { get; set; }
|
||||
}
|
||||
@@ -45,6 +45,7 @@ public static class WireMockServerSettingsParser
|
||||
AdminAzureADTenant = parser.GetStringValue(nameof(WireMockServerSettings.AdminAzureADTenant)),
|
||||
AdminPassword = parser.GetStringValue(nameof(WireMockServerSettings.AdminPassword)),
|
||||
AdminUsername = parser.GetStringValue(nameof(WireMockServerSettings.AdminUsername)),
|
||||
AdminPath = parser.GetStringValue(nameof(WireMockServerSettings.AdminPath), "/__admin"),
|
||||
AllowBodyForAllHttpMethods = parser.GetBoolValue(nameof(WireMockServerSettings.AllowBodyForAllHttpMethods)),
|
||||
AllowCSharpCodeMatcher = parser.GetBoolValue(nameof(WireMockServerSettings.AllowCSharpCodeMatcher)),
|
||||
AllowOnlyDefinedHttpStatusCodeInResponse = parser.GetBoolValue(nameof(WireMockServerSettings.AllowOnlyDefinedHttpStatusCodeInResponse)),
|
||||
|
||||
@@ -181,13 +181,17 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.2.1" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.2.1" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.2.1" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.2.1" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.2.1" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.2.1" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.2.1" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.4" />
|
||||
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' ">
|
||||
<PackageReference Include="Handlebars.Net.Helpers.Xslt" Version="2.4.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -95,6 +95,28 @@ public partial class WireMockAdminApiTests
|
||||
Check.That(settings).IsNotNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_GetSettingsAsync_ForDifferentAdminPath()
|
||||
{
|
||||
// Arrange
|
||||
var server = WireMockServer.Start(w =>
|
||||
{
|
||||
w.StartAdminInterface = true;
|
||||
w.AdminPath = "/foo/__admin";
|
||||
});
|
||||
var api = RestClient.For<IWireMockAdminApi>(server.Urls[0] + "/foo");
|
||||
|
||||
// Act
|
||||
var settings = await api.GetSettingsAsync().ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
Check.That(settings).IsNotNull();
|
||||
|
||||
// Cleanup
|
||||
server.Stop();
|
||||
server.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IWireMockAdminApi_PostSettingsAsync()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
Guid: 53241df5-582c-458a-a67b-6de3d1d0508e,
|
||||
UpdatedAt: DateTime_1,
|
||||
Title: This is my title 1,
|
||||
Request: {
|
||||
Path: {
|
||||
Matchers: [
|
||||
{
|
||||
Name: WildcardMatcher,
|
||||
Pattern: /bla1,
|
||||
IgnoreCase: false
|
||||
}
|
||||
]
|
||||
},
|
||||
Methods: [
|
||||
POST
|
||||
],
|
||||
Body: {
|
||||
Matcher: {
|
||||
Name: JsonPartialMatcher,
|
||||
Pattern: {
|
||||
test: abc
|
||||
},
|
||||
IgnoreCase: false,
|
||||
Regex: false
|
||||
}
|
||||
}
|
||||
},
|
||||
Response: {
|
||||
Body: The Response
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
#if !(NET452 || NET461 || NETCOREAPP3_1)
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using FluentAssertions;
|
||||
using VerifyTests;
|
||||
using VerifyXunit;
|
||||
using WireMock.Client;
|
||||
using WireMock.Client.Extensions;
|
||||
using WireMock.Net.Tests.VerifyExtensions;
|
||||
using WireMock.Server;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Client.Builders;
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
[UsesVerify]
|
||||
public class AdminApiMappingBuilderTests
|
||||
{
|
||||
private static readonly VerifySettings VerifySettings = new();
|
||||
static AdminApiMappingBuilderTests()
|
||||
{
|
||||
VerifyNewtonsoftJson.Enable(VerifySettings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetMappingBuilder_BuildAndPostAsync()
|
||||
{
|
||||
using var server = WireMockServer.StartWithAdminInterface();
|
||||
|
||||
var api = RestEase.RestClient.For<IWireMockAdminApi>(server.Url!);
|
||||
|
||||
var guid = Guid.Parse("53241df5-582c-458a-a67b-6de3d1d0508e");
|
||||
var mappingBuilder = api.GetMappingBuilder();
|
||||
mappingBuilder.Given(m => m
|
||||
.WithTitle("This is my title 1")
|
||||
.WithGuid(guid)
|
||||
.WithRequest(req => req
|
||||
.UsingPost()
|
||||
.WithPath("/bla1")
|
||||
.WithBody(body => body
|
||||
.WithMatcher(matcher => matcher
|
||||
.WithName("JsonPartialMatcher")
|
||||
.WithPattern(new { test = "abc" })
|
||||
)
|
||||
)
|
||||
)
|
||||
.WithResponse(rsp => rsp
|
||||
.WithBody("The Response")
|
||||
)
|
||||
);
|
||||
|
||||
// Act
|
||||
var status = await mappingBuilder.BuildAndPostAsync().ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
status.Status.Should().Be("Mapping added");
|
||||
|
||||
var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
|
||||
|
||||
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
|
||||
|
||||
server.Stop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
40
test/WireMock.Net.Tests/Extensions/EnumExtensionsTests.cs
Normal file
40
test/WireMock.Net.Tests/Extensions/EnumExtensionsTests.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using WireMock.Extensions;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Extensions;
|
||||
|
||||
public class EnumExtensionsTests
|
||||
{
|
||||
private enum TestEnum
|
||||
{
|
||||
Value1
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnumExtensions_GetFullyQualifiedEnumValue_ShouldReturnCorrectValue()
|
||||
{
|
||||
// Arrange
|
||||
var enumValue = TestEnum.Value1;
|
||||
|
||||
// Act
|
||||
var result = enumValue.GetFullyQualifiedEnumValue();
|
||||
|
||||
// Assert
|
||||
result.Should().Be("WireMock.Net.Tests.Extensions.TestEnum.Value1");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnumExtensions_GetFullyQualifiedEnumValue_ShouldThrowArgumentException_WhenTypeIsNotEnum()
|
||||
{
|
||||
// Arrange
|
||||
int nonEnumValue = 42;
|
||||
|
||||
// Act
|
||||
Action act = () => nonEnumValue.GetFullyQualifiedEnumValue();
|
||||
|
||||
// Assert
|
||||
act.Should().Throw<ArgumentException>().WithMessage("T must be an enum");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
#if MIMEKIT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
@@ -34,8 +35,123 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
|
||||
--=-5XgmpXt0XOfzdtcgNJc2ZQ==--
|
||||
";
|
||||
|
||||
[Fact]
|
||||
public void RequestMessageBodyMatcher_GetMatchingScore_BodyAsMultiPart()
|
||||
private static readonly MimePartMatcher PerfectTextPlainMatcher = new(
|
||||
MatchBehaviour.AcceptOnMatch,
|
||||
new ContentTypeMatcher("text/plain"),
|
||||
null,
|
||||
null,
|
||||
new ExactMatcher("This is some plain text")
|
||||
);
|
||||
|
||||
private static readonly MimePartMatcher PerfectPartTextMatcher = new(
|
||||
MatchBehaviour.AcceptOnMatch,
|
||||
new ContentTypeMatcher("text/json"),
|
||||
null,
|
||||
null,
|
||||
new JsonMatcher(new { Key = "Value" }, true)
|
||||
);
|
||||
|
||||
private static readonly MimePartMatcher PerfectImagePngMatcher = new(
|
||||
MatchBehaviour.AcceptOnMatch,
|
||||
new ContentTypeMatcher("image/png"),
|
||||
new ExactMatcher("attachment; filename=\"image.png\""),
|
||||
new ExactMatcher("base64"),
|
||||
new ExactObjectMatcher(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAgMAAAAP2OW3AAAADFBMVEX/tID/vpH/pWX/sHidUyjlAAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC"))
|
||||
);
|
||||
|
||||
private static readonly MimePartMatcher MismatchTextPlainMatcher = new(
|
||||
MatchBehaviour.AcceptOnMatch,
|
||||
new ContentTypeMatcher("text/plain"),
|
||||
null,
|
||||
null,
|
||||
new ExactMatcher("--INVALID TEXT--")
|
||||
);
|
||||
|
||||
private static readonly MimePartMatcher MismatchPartTextMatcher = new(
|
||||
MatchBehaviour.AcceptOnMatch,
|
||||
new ContentTypeMatcher("text/json"),
|
||||
null,
|
||||
null,
|
||||
new JsonMatcher(new { Key = "InvalidValue" }, true)
|
||||
);
|
||||
|
||||
private static readonly MimePartMatcher MismatchImagePngMatcher = new(
|
||||
MatchBehaviour.AcceptOnMatch,
|
||||
new ContentTypeMatcher("image/png"),
|
||||
new ExactMatcher("attachment; filename=\"invalid.png\""),
|
||||
new ExactMatcher("base64"),
|
||||
null
|
||||
);
|
||||
|
||||
public static TheoryData<IMatcher?, IMatcher?, IMatcher?> PerfectMatchersData => new()
|
||||
{
|
||||
{ PerfectTextPlainMatcher, null, null },
|
||||
{ PerfectPartTextMatcher, null, null },
|
||||
{ PerfectImagePngMatcher, null, null },
|
||||
{ PerfectPartTextMatcher, PerfectTextPlainMatcher, null },
|
||||
{ PerfectPartTextMatcher, PerfectImagePngMatcher, PerfectTextPlainMatcher },
|
||||
};
|
||||
|
||||
public static TheoryData<IMatcher?, IMatcher?, IMatcher?> MismatchMatchersData => new()
|
||||
{
|
||||
{ MismatchTextPlainMatcher, null, null },
|
||||
{ MismatchPartTextMatcher, null, null },
|
||||
{ MismatchImagePngMatcher, null, null },
|
||||
{ MismatchPartTextMatcher, MismatchTextPlainMatcher, null },
|
||||
{ MismatchPartTextMatcher, MismatchImagePngMatcher, MismatchTextPlainMatcher },
|
||||
};
|
||||
|
||||
public static TheoryData<IMatcher?, IMatcher?, IMatcher?> MixedMatchersData => new()
|
||||
{
|
||||
{ MismatchPartTextMatcher, PerfectTextPlainMatcher, null },
|
||||
{ PerfectPartTextMatcher, MismatchImagePngMatcher, null },
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(PerfectMatchersData))]
|
||||
public void RequestMessageBodyMatcher_GetMatchingScore_BodyAsMultiPart_Perfect(IMatcher? matcher1, IMatcher? matcher2, IMatcher? matcher3)
|
||||
{
|
||||
// Assign
|
||||
var score = GetScore(matcher1, matcher2, matcher3);
|
||||
|
||||
// Assert
|
||||
score.Should().Be(MatchScores.Perfect);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(MismatchMatchersData))]
|
||||
public void RequestMessageBodyMatcher_GetMatchingScore_BodyAsMultiPart_Mismatch(IMatcher? matcher1, IMatcher? matcher2, IMatcher? matcher3)
|
||||
{
|
||||
// Assign
|
||||
var score = GetScore(matcher1, matcher2, matcher3);
|
||||
|
||||
// Assert
|
||||
score.Should().Be(MatchScores.Mismatch);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(MixedMatchersData))]
|
||||
public void RequestMessageBodyMatcher_GetMatchingScore_BodyAsMultiPart_Mixed_With_And(IMatcher? matcher1, IMatcher? matcher2, IMatcher? matcher3)
|
||||
{
|
||||
// Assign
|
||||
var score = GetScore(matcher1, matcher2, matcher3);
|
||||
|
||||
// Assert
|
||||
score.Should().Be(MatchScores.Mismatch);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(MixedMatchersData))]
|
||||
public void RequestMessageBodyMatcher_GetMatchingScore_BodyAsMultiPart_Mixed_With_Or(IMatcher? matcher1, IMatcher? matcher2, IMatcher? matcher3)
|
||||
{
|
||||
// Assign
|
||||
var score = GetScore(matcher1, matcher2, matcher3, MatchOperator.Or);
|
||||
|
||||
// Assert
|
||||
score.Should().Be(MatchScores.Perfect);
|
||||
}
|
||||
|
||||
private static double GetScore(IMatcher? matcher1, IMatcher? matcher2, IMatcher? matcher3, MatchOperator matchOperator = MatchOperator.And)
|
||||
{
|
||||
// Assign
|
||||
var body = new BodyData
|
||||
@@ -44,41 +160,20 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
|
||||
DetectedBodyType = BodyType.MultiPart
|
||||
};
|
||||
|
||||
var textPlainContentTypeMatcher = new ContentTypeMatcher("text/plain");
|
||||
var textPlainContentMatcher = new ExactMatcher("This is some plain text");
|
||||
var textPlainMatcher = new MimePartMatcher(MatchBehaviour.AcceptOnMatch, textPlainContentTypeMatcher, null, null, textPlainContentMatcher);
|
||||
|
||||
var partTextJsonContentTypeMatcher = new ContentTypeMatcher("text/json");
|
||||
var partTextJsonContentMatcher = new JsonMatcher(new { Key = "Value" }, true);
|
||||
var partTextMatcher = new MimePartMatcher(MatchBehaviour.AcceptOnMatch, partTextJsonContentTypeMatcher, null, null, partTextJsonContentMatcher);
|
||||
|
||||
var imagePngContentTypeMatcher = new ContentTypeMatcher("image/png");
|
||||
var imagePngContentDispositionMatcher = new ExactMatcher("attachment; filename=\"image.png\"");
|
||||
var imagePngContentTransferEncodingMatcher = new ExactMatcher("base64");
|
||||
var imagePngContentMatcher = new ExactObjectMatcher(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAgMAAAAP2OW3AAAADFBMVEX/tID/vpH/pWX/sHidUyjlAAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC"));
|
||||
var imagePngMatcher = new MimePartMatcher(MatchBehaviour.AcceptOnMatch, imagePngContentTypeMatcher, imagePngContentDispositionMatcher, imagePngContentTransferEncodingMatcher, imagePngContentMatcher);
|
||||
|
||||
var matchers = new IMatcher[]
|
||||
{
|
||||
textPlainMatcher,
|
||||
partTextMatcher,
|
||||
imagePngMatcher
|
||||
};
|
||||
|
||||
var headers = new Dictionary<string, string[]>
|
||||
{
|
||||
{ "Content-Type", new[] { @"multipart/mixed; boundary=""=-5XgmpXt0XOfzdtcgNJc2ZQ==""" } }
|
||||
};
|
||||
var requestMessage = new RequestMessage(new UrlDetails("http://localhost"), "GET", "127.0.0.1", body, headers);
|
||||
var matchers = new IMatcher?[] { matcher1, matcher2, matcher3 }
|
||||
.Where(m => m is not null)
|
||||
.ToArray();
|
||||
|
||||
var matcher = new RequestMessageMultiPartMatcher(matchers);
|
||||
var matcher = new RequestMessageMultiPartMatcher(MatchBehaviour.AcceptOnMatch, matchOperator, matchers!);
|
||||
|
||||
// Act
|
||||
var result = new RequestMatchResult();
|
||||
var score = matcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
score.Should().Be(MatchScores.Perfect);
|
||||
return matcher.GetMatchingScore(requestMessage, result);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
using FluentAssertions;
|
||||
using WireMock.Settings;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Settings;
|
||||
|
||||
public class WireMockServerSettingsParserTests
|
||||
{
|
||||
[Fact]
|
||||
public void TryParseArguments_With_Args()
|
||||
{
|
||||
// Act
|
||||
var result = WireMockServerSettingsParser.TryParseArguments(new[]
|
||||
{
|
||||
"--adminPath", "ap"
|
||||
}, null, out var settings);
|
||||
|
||||
// Assert
|
||||
result.Should().BeTrue();
|
||||
settings.Should().NotBeNull();
|
||||
settings!.AdminPath.Should().Be("ap");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseArguments_Without_Args()
|
||||
{
|
||||
// Act
|
||||
var result = WireMockServerSettingsParser.TryParseArguments(new string[] { }, null, out var settings);
|
||||
|
||||
// Assert
|
||||
result.Should().BeTrue();
|
||||
settings.Should().NotBeNull();
|
||||
settings!.AdminPath.Should().Be("/__admin");
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using NFluent;
|
||||
using WireMock.Admin.Settings;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Logging;
|
||||
using WireMock.RequestBuilders;
|
||||
@@ -22,13 +23,9 @@ namespace WireMock.Net.Tests;
|
||||
public class WireMockServerAdminTests
|
||||
{
|
||||
// For for AppVeyor + OpenCover
|
||||
private string GetCurrentFolder()
|
||||
private static string GetCurrentFolder()
|
||||
{
|
||||
string current = Directory.GetCurrentDirectory();
|
||||
//if (!current.EndsWith("WireMock.Net.Tests"))
|
||||
// return Path.Combine(current, "test", "WireMock.Net.Tests");
|
||||
|
||||
return current;
|
||||
return Directory.GetCurrentDirectory();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -468,9 +465,9 @@ public class WireMockServerAdminTests
|
||||
|
||||
Check.That(server.MappingModels.Count()).Equals(3);
|
||||
|
||||
Guid? guid1 = server.MappingModels.ElementAt(0).Guid;
|
||||
Guid? guid2 = server.MappingModels.ElementAt(1).Guid;
|
||||
Guid? guid3 = server.MappingModels.ElementAt(2).Guid;
|
||||
var guid1 = server.MappingModels.ElementAt(0).Guid;
|
||||
var guid2 = server.MappingModels.ElementAt(1).Guid;
|
||||
var guid3 = server.MappingModels.ElementAt(2).Guid;
|
||||
|
||||
Check.That(guid1).IsNotNull();
|
||||
Check.That(guid2).IsNotNull();
|
||||
@@ -482,7 +479,7 @@ public class WireMockServerAdminTests
|
||||
$"]";
|
||||
|
||||
// Act
|
||||
var request = new HttpRequestMessage()
|
||||
var request = new HttpRequestMessage
|
||||
{
|
||||
Method = HttpMethod.Delete,
|
||||
RequestUri = new Uri($"http://localhost:{server.Ports[0]}/__admin/mappings"),
|
||||
@@ -501,22 +498,45 @@ public class WireMockServerAdminTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WireMockServer_Admin_()
|
||||
public async Task WireMockServer_CreateClient_And_CallEndpoint()
|
||||
{
|
||||
// given
|
||||
// Arrange
|
||||
var server = WireMockServer.Start();
|
||||
var client = server.CreateClient();
|
||||
|
||||
server.CreateClient();
|
||||
// Act
|
||||
await client.GetAsync($"{server.Url}/foo").ConfigureAwait(false);
|
||||
|
||||
// when
|
||||
await new HttpClient().GetAsync("http://localhost:" + server.Ports[0] + "/foo").ConfigureAwait(false);
|
||||
|
||||
// then
|
||||
// Assert
|
||||
Check.That(server.LogEntries).HasSize(1);
|
||||
var requestLogged = server.LogEntries.First();
|
||||
Check.That(requestLogged.RequestMessage.Method).IsEqualTo("GET");
|
||||
Check.That(requestLogged.RequestMessage.BodyData).IsNull();
|
||||
|
||||
// Cleanup
|
||||
server.Stop();
|
||||
server.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WireMockServer_CreateClient_And_CallAdminSettingsEndpoint()
|
||||
{
|
||||
// Arrange
|
||||
var server = WireMockServer.Start(w =>
|
||||
{
|
||||
w.StartAdminInterface = true;
|
||||
w.AdminPath = "/adm";
|
||||
});
|
||||
var client = server.CreateClient();
|
||||
|
||||
// Act
|
||||
var settings = await client.GetStringAsync($"{server.Url}/adm/settings").ConfigureAwait(false);
|
||||
|
||||
// Assert
|
||||
settings.Should().NotBeNull();
|
||||
|
||||
// Cleanup
|
||||
server.Stop();
|
||||
server.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user