Compare commits

...

13 Commits

Author SHA1 Message Date
Stef Heyenrath
68ad015dcf 1.5.43 2023-12-11 17:34:39 +01:00
sameena syed
97d26338e6 Proxy all requests - even a repeated one (#1038)
* Adding proxyall

* Adding proxyAll flag

* Reverting extra spaces added

* Make proxyall to true

* Resolving review comments for proxyall

* Resolving codefactor spaces in the code

* Adding proxyall parser in wmserversettingsparser

---------

Co-authored-by: Sameena Syed <sameena.syed@nexigroup.com>
2023-12-11 17:16:30 +01:00
Stef Heyenrath
0c6129e86b Add ProxyUrlReplaceSettings to Response (#1026) 2023-12-10 09:57:37 +01:00
Stef Heyenrath
61c8ce76eb 1.5.42 2023-12-09 09:24:27 +01:00
Stef Heyenrath
8e1b6f87f0 Workaround for: Random.Generate Type="Long" (#1034)
* Workaround for: Random.Generate Type="Long"

* x

* 11

* .

* 2
2023-12-09 09:18:16 +01:00
Stef Heyenrath
c6c7ba13b4 Calling Reset also resets the scenarios (#1031)
* Calling Reset also resets the scenarios

* .
2023-12-07 16:03:37 +01:00
Stef Heyenrath
1174acce6e ResponseWithHandlebarsDateTimeTests (#1029) 2023-12-06 20:20:45 +01:00
Stef Heyenrath
932dde07e4 FixMapping[] for WireMock.Org REST API (#1023) 2023-12-06 09:24:58 +01:00
Stef Heyenrath
c193bcf61f 1.5.41 - releasenotes 2023-12-04 18:11:55 +01:00
Stef Heyenrath
9757245c61 1.5.41 2023-12-04 18:09:03 +01:00
Stef Heyenrath
8b91cec457 Add .NET 8 (#1018)
* Add .NET 8

* 'Use .NET 8'

* tests 8

* 8

* tc8

* ci

* CI
2023-12-04 18:05:18 +01:00
Stef Heyenrath
fb3ae53e1c GraphQL - custom scalar support (#1012)
* x

* CustomScalars

* more tests

* .

* add or set

* ...

* x
2023-12-04 18:02:03 +01:00
Stef Heyenrath
124ecc2097 Add Github Action (#1020)
* CI github action

* push
2023-11-21 08:12:54 +01:00
94 changed files with 1857 additions and 1926 deletions

View File

@@ -10,6 +10,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1

56
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,56 @@
name: Build with Tests
on:
pull_request:
branches:
- '**'
push:
branches:
- 'main'
jobs:
windows-build-and-run:
runs-on: windows-2022
env:
IsRunningOnGitHubActions: 'true'
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
linux-build-and-run:
runs-on: ubuntu-latest
env:
IsRunningOnGitHubActions: 'true'
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

View File

@@ -1,3 +1,23 @@
# 1.5.43 (11 December 2023)
- [#1026](https://github.com/WireMock-Net/WireMock.Net/pull/1026) - Add ProxyUrlReplaceSettings to Response [feature] contributed by [StefH](https://github.com/StefH)
- [#1038](https://github.com/WireMock-Net/WireMock.Net/pull/1038) - Proxy all requests - even a repeated one [feature] contributed by [sameena-ops](https://github.com/sameena-ops)
- [#592](https://github.com/WireMock-Net/WireMock.Net/issues/592) - Proxy all requests - even a repeated one [feature]
- [#1024](https://github.com/WireMock-Net/WireMock.Net/issues/1024) - Scenario with proxy not removing route prefix [feature]
# 1.5.42 (09 December 2023)
- [#1023](https://github.com/WireMock-Net/WireMock.Net/pull/1023) - Fix Mapping[] for WireMock.Org REST API [bug] contributed by [StefH](https://github.com/StefH)
- [#1029](https://github.com/WireMock-Net/WireMock.Net/pull/1029) - Add ResponseWithHandlebarsDateTimeTests [test] contributed by [StefH](https://github.com/StefH)
- [#1031](https://github.com/WireMock-Net/WireMock.Net/pull/1031) - Calling Reset also resets the scenarios [bug] contributed by [StefH](https://github.com/StefH)
- [#1034](https://github.com/WireMock-Net/WireMock.Net/pull/1034) - Workaround for: Random.Generate Type=&quot;Long&quot; [bug] contributed by [StefH](https://github.com/StefH)
- [#1021](https://github.com/WireMock-Net/WireMock.Net/issues/1021) - GetAdminMappingsResult in WireMock.Org.Abstractions should contain list of mappings [bug]
- [#1030](https://github.com/WireMock-Net/WireMock.Net/issues/1030) - Reset resets only mappings and logentries, not scenarios. [bug]
# 1.5.41 (04 December 2023)
- [#1012](https://github.com/WireMock-Net/WireMock.Net/pull/1012) - GraphQL - custom scalar support [feature] contributed by [StefH](https://github.com/StefH)
- [#1018](https://github.com/WireMock-Net/WireMock.Net/pull/1018) - Add .NET 8 [feature] contributed by [StefH](https://github.com/StefH)
- [#1020](https://github.com/WireMock-Net/WireMock.Net/pull/1020) - Add Github Action [test] contributed by [StefH](https://github.com/StefH)
- [#984](https://github.com/WireMock-Net/WireMock.Net/issues/984) - GraphQL Schema validation with custom scalars [feature]
# 1.5.40 (07 November 2023)
- [#1009](https://github.com/WireMock-Net/WireMock.Net/pull/1009) - Add more tests for JmesPathMatchers and StringUtils.ParseMatchOperator [test] contributed by [StefH](https://github.com/StefH)
- [#1010](https://github.com/WireMock-Net/WireMock.Net/pull/1010) - Add unit tests for HttpClient with WebProxy [test] contributed by [StefH](https://github.com/StefH)

View File

@@ -4,7 +4,7 @@
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>1.5.40</VersionPrefix>
<VersionPrefix>1.5.43</VersionPrefix>
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>

View File

@@ -1,6 +1,6 @@
rem https://github.com/StefH/GitHubReleaseNotes
SET version=1.5.40
SET version=1.5.43
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version% --token %GH_TOKEN%

View File

@@ -1,7 +1,7 @@
# 1.5.40 (07 November 2023)
- #1009 Add more tests for JmesPathMatchers and StringUtils.ParseMatchOperator [test]
- #1010 Add unit tests for HttpClient with WebProxy [test]
- #1011 GraphQL - add support for standard scalar types in the schema [feature]
- #1014 FluentAssertions - WithBody and WithBodyAsJson and WithBodyAsBytes
# 1.5.43 (11 December 2023)
- #1026 Add ProxyUrlReplaceSettings to Response [feature]
- #1038 Proxy all requests - even a repeated one [feature]
- #592 Proxy all requests - even a repeated one [feature]
- #1024 Scenario with proxy not removing route prefix [feature]
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md

View File

@@ -42,14 +42,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Client", "exam
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NETCoreApp", "examples\WireMock.Net.Console.NETCoreApp\WireMock.Net.Console.NETCoreApp.csproj", "{FE281639-B014-4C8A-96FA-141164A74713}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.StandAlone.NETCoreApp", "examples\WireMock.Net.StandAlone.NETCoreApp\WireMock.Net.StandAlone.NETCoreApp.csproj", "{10E16614-61CA-48D8-8BDD-664C13913DED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.StandAlone.Net452", "examples\WireMock.Net.StandAlone.Net452\WireMock.Net.StandAlone.Net452.csproj", "{668F689E-57B4-422E-8846-C0FF643CA999}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.Proxy.Net452", "examples\WireMock.Net.Console.Proxy.Net452\WireMock.Net.Console.Proxy.Net452.csproj", "{26433A8F-BF01-4962-97EB-81BFFBB61096}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.StandAlone.Net461", "examples\WireMock.Net.StandAlone.Net461\WireMock.Net.StandAlone.Net461.csproj", "{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Service", "examples\Wiremock.Net.Service\WireMock.Net.Service.csproj", "{7F0B2446-0363-4720-AF46-F47F83B557DC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console.Net461.Classic", "examples\WireMock.Net.Console.Net461.Classic\WireMock.Net.Console.Net461.Classic.csproj", "{1261BB9B-A7D4-456C-8985-3CE560361B8E}"
@@ -82,6 +76,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\CreateRelease.yml = .github\workflows\CreateRelease.yml
EndProjectSection
EndProject
@@ -113,7 +108,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueProxy", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Testcontainers", "src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj", "{12B016A5-9D8B-4EFE-96C2-CA51BE43367D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.TestcontainersExample", "examples\WireMock.Net.TestcontainersExample\WireMock.Net.TestcontainersExample.csproj", "{56A38798-C48B-4A4A-B805-071E05C02CE1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.TestcontainersExample", "examples\WireMock.Net.TestcontainersExample\WireMock.Net.TestcontainersExample.csproj", "{56A38798-C48B-4A4A-B805-071E05C02CE1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{0147029F-FA4A-44B3-B79A-3C3574054EE4}"
EndProject
@@ -121,6 +116,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultipartUploader", "tools\
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}"
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -163,22 +160,10 @@ Global
{FE281639-B014-4C8A-96FA-141164A74713}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE281639-B014-4C8A-96FA-141164A74713}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE281639-B014-4C8A-96FA-141164A74713}.Release|Any CPU.Build.0 = Release|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10E16614-61CA-48D8-8BDD-664C13913DED}.Release|Any CPU.Build.0 = Release|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Debug|Any CPU.Build.0 = Debug|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.ActiveCfg = Release|Any CPU
{668F689E-57B4-422E-8846-C0FF643CA999}.Release|Any CPU.Build.0 = Release|Any CPU
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26433A8F-BF01-4962-97EB-81BFFBB61096}.Release|Any CPU.Build.0 = Release|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}.Release|Any CPU.Build.0 = Release|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F0B2446-0363-4720-AF46-F47F83B557DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -291,6 +276,10 @@ Global
{941229D6-191B-4B5E-AC81-0905EBF4F19D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{941229D6-191B-4B5E-AC81-0905EBF4F19D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{941229D6-191B-4B5E-AC81-0905EBF4F19D}.Release|Any CPU.Build.0 = Release|Any CPU
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -305,10 +294,7 @@ Global
{41C19451-E980-4ED4-A011-DA7A1C23FC05} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{74D91AD0-D96D-4FD2-AEC5-CC49D38346C0} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{FE281639-B014-4C8A-96FA-141164A74713} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{10E16614-61CA-48D8-8BDD-664C13913DED} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{668F689E-57B4-422E-8846-C0FF643CA999} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{26433A8F-BF01-4962-97EB-81BFFBB61096} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{3C279524-DB73-4DE3-BEF1-F2B2958C9F65} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{7F0B2446-0363-4720-AF46-F47F83B557DC} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{1261BB9B-A7D4-456C-8985-3CE560361B8E} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{668F689E-57B4-422E-8846-C0FF643CA268} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
@@ -339,6 +325,7 @@ Global
{56A38798-C48B-4A4A-B805-071E05C02CE1} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{07C30227-ADEC-4BDE-8CDC-849D85A690BB} = {0147029F-FA4A-44B3-B79A-3C3574054EE4}
{941229D6-191B-4B5E-AC81-0905EBF4F19D} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{1EA72C0F-92E9-486B-8FFE-53F992BFC4AA} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458}

View File

@@ -6,13 +6,13 @@ variables:
steps:
- task: UseDotNet@2
displayName: 'Use .NET 7'
displayName: 'Use .NET 8'
inputs:
packageType: sdk
version: 7.0.x
version: 8.0.x
- script: |
dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --configuration $(buildConfiguration) --framework net7.0 --logger trx
dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --configuration $(buildConfiguration) --framework net8.0 --logger trx
displayName: 'Test'
- task: PublishTestResults@2

View File

@@ -15,10 +15,10 @@ jobs:
displayName: 'Print buildId'
- task: UseDotNet@2
displayName: Use .NET 7.0
displayName: Use .NET 8.0
inputs:
packageType: 'sdk'
version: '7.0.x'
version: '8.0.x'
- task: PowerShell@2
displayName: "Use JDK11 by default"
@@ -41,18 +41,18 @@ jobs:
projectKey: 'WireMock-Net_WireMock.Net'
projectName: 'WireMock.Net'
extraProperties: |
sonar.cs.opencover.reportsPaths=**/coverage.net7.0.opencover.xml
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 net7.0'
arguments: '--configuration Debug --framework net8.0'
- task: CmdLine@2
inputs:
script: 'dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net7.0'
script: 'dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net8.0'
displayName: 'Execute Unit Tests with Coverage'
- task: SonarCloudAnalyze@1
@@ -68,7 +68,7 @@ jobs:
condition: and(succeeded(), eq(variables['RUN_WHITESOURCE'], 'yes'))
- script: |
bash <(curl https://codecov.io/bash) -t $(CODECOV_TOKEN) -f ./test/WireMock.Net.Tests/coverage.7.0.opencover.xml
bash <(curl https://codecov.io/bash) -t $(CODECOV_TOKEN) -f ./test/WireMock.Net.Tests/coverage.8.0.opencover.xml
displayName: 'codecov'
- task: PublishTestResults@2
@@ -80,7 +80,7 @@ jobs:
- task: PublishBuildArtifacts@1
displayName: Publish coverage file
inputs:
PathtoPublish: './test/WireMock.Net.Tests/coverage.net7.0.opencover.xml'
PathtoPublish: './test/WireMock.Net.Tests/coverage.net8.0.opencover.xml'
- job: Windows_Build_Test
@@ -89,24 +89,24 @@ jobs:
steps:
- task: UseDotNet@2
displayName: Use .NET 7.0
displayName: Use .NET 8.0
inputs:
packageType: 'sdk'
version: '7.0.x'
version: '8.0.x'
- task: DotNetCoreCLI@2
displayName: 'Build Unit tests'
inputs:
command: 'build'
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
arguments: '--configuration Debug --framework net7.0'
arguments: '--configuration Debug --framework net8.0'
- task: DotNetCoreCLI@2
displayName: 'Execute Unit Tests with Coverage'
inputs:
command: 'test'
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
arguments: '--no-build --configuration Debug --framework net7.0 --collect:"XPlat Code Coverage" --logger trx'
arguments: '--no-build --configuration Debug --framework net8.0 --collect:"XPlat Code Coverage" --logger trx'
- job: Windows_Release_to_MyGet
dependsOn: Windows_Build_Test
@@ -116,10 +116,10 @@ jobs:
steps:
- task: UseDotNet@2
displayName: Use .NET 7.0
displayName: Use .NET 8.0
inputs:
packageType: 'sdk'
version: '7.0.x'
version: '8.0.x'
- task: DotNetCoreCLI@2
displayName: Build Release

View File

@@ -10,10 +10,10 @@ variables:
steps:
- task: UseDotNet@2
displayName: 'Use .NET 7'
displayName: 'Use .NET 8'
inputs:
packageType: sdk
version: 7.0.x
version: 8.0.x
- task: DotNetCoreCLI@2
displayName: Build Release

View File

@@ -13,10 +13,10 @@ steps:
displayName: 'Print buildId'
- task: UseDotNet@2
displayName: 'Use .NET 7'
displayName: 'Use .NET 8'
inputs:
packageType: sdk
version: 7.0.x
version: 8.0.x
# Based on https://whereslou.com/2018/09/versioning-and-publishing-nuget-packages-automatically-using-azure-devops-pipelines/
- task: DotNetCoreCLI@2

View File

@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<DefineConstants>$(DefineConstants);GRAPHQL;MIMEKIT</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\WireMock.Net.Console.Net452.Classic\MainApp.cs" Link="MainApp.cs" />
<Compile Include="..\WireMock.Net.Console.Net452.Classic\CustomFileSystemFileHandler.cs" Link="CustomFileSystemFileHandler.cs" />
<Compile Include="..\WireMock.Net.Console.NETCoreApp\Program.cs" Link="Program.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="__admin\mappings\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Remove="__admin\mappings\1.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<None Update="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="nlog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1 @@
// C# Hello

View File

@@ -0,0 +1,23 @@
{
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/static/mapping",
}
]
},
"Methods": [
"get",
"post"
]
},
"Response": {
"BodyAsJson": { "body": "static mapping" },
"Headers": {
"Content-Type": "application/json",
"Test-X": [ "test 1", "test 2" ]
}
}
}

View File

@@ -0,0 +1,29 @@
{
"Guid": "791a3f31-6946-4ce7-8e6f-0237c7443275",
"Title": "",
"Priority": 0,
"Request": {
"Path": "/proxy-google-test-post",
"Methods": [
"post"
],
"Body": {}
},
"Response": {
"StatusCode": 404,
"Body": "<!DOCTYPE html>\n<html lang=en>\n <meta charset=utf-8>\n <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\n <title>Error 404 (Not Found)!!1</title>\n <style>\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n </style>\n <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n <p><b>404.</b> <ins>Thats an error.</ins>\n <p>The requested URL <code>/proxy-google-test-post</code> was not found on this server. <ins>Thats all we know.</ins>\n",
"BodyAsBytes": "PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ZW4+CiAgPG1ldGEgY2hhcnNldD11dGYtOD4KICA8bWV0YSBuYW1lPXZpZXdwb3J0IGNvbnRlbnQ9ImluaXRpYWwtc2NhbGU9MSwgbWluaW11bS1zY2FsZT0xLCB3aWR0aD1kZXZpY2Utd2lkdGgiPgogIDx0aXRsZT5FcnJvciA0MDQgKE5vdCBGb3VuZCkhITE8L3RpdGxlPgogIDxzdHlsZT4KICAgICp7bWFyZ2luOjA7cGFkZGluZzowfWh0bWwsY29kZXtmb250OjE1cHgvMjJweCBhcmlhbCxzYW5zLXNlcmlmfWh0bWx7YmFja2dyb3VuZDojZmZmO2NvbG9yOiMyMjI7cGFkZGluZzoxNXB4fWJvZHl7bWFyZ2luOjclIGF1dG8gMDttYXgtd2lkdGg6MzkwcHg7bWluLWhlaWdodDoxODBweDtwYWRkaW5nOjMwcHggMCAxNXB4fSogPiBib2R5e2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2Vycm9ycy9yb2JvdC5wbmcpIDEwMCUgNXB4IG5vLXJlcGVhdDtwYWRkaW5nLXJpZ2h0OjIwNXB4fXB7bWFyZ2luOjExcHggMCAyMnB4O292ZXJmbG93OmhpZGRlbn1pbnN7Y29sb3I6Izc3Nzt0ZXh0LWRlY29yYXRpb246bm9uZX1hIGltZ3tib3JkZXI6MH1AbWVkaWEgc2NyZWVuIGFuZCAobWF4LXdpZHRoOjc3MnB4KXtib2R5e2JhY2tncm91bmQ6bm9uZTttYXJnaW4tdG9wOjA7bWF4LXdpZHRoOm5vbmU7cGFkZGluZy1yaWdodDowfX0jbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzF4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7bWFyZ2luLWxlZnQ6LTVweH1AbWVkaWEgb25seSBzY3JlZW4gYW5kIChtaW4tcmVzb2x1dGlvbjoxOTJkcGkpeyNsb2dve2JhY2tncm91bmQ6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIG5vLXJlcGVhdCAwJSAwJS8xMDAlIDEwMCU7LW1vei1ib3JkZXItaW1hZ2U6dXJsKC8vd3d3Lmdvb2dsZS5jb20vaW1hZ2VzL2JyYW5kaW5nL2dvb2dsZWxvZ28vMngvZ29vZ2xlbG9nb19jb2xvcl8xNTB4NTRkcC5wbmcpIDB9fUBtZWRpYSBvbmx5IHNjcmVlbiBhbmQgKC13ZWJraXQtbWluLWRldmljZS1waXhlbC1yYXRpbzoyKXsjbG9nb3tiYWNrZ3JvdW5kOnVybCgvL3d3dy5nb29nbGUuY29tL2ltYWdlcy9icmFuZGluZy9nb29nbGVsb2dvLzJ4L2dvb2dsZWxvZ29fY29sb3JfMTUweDU0ZHAucG5nKSBuby1yZXBlYXQ7LXdlYmtpdC1iYWNrZ3JvdW5kLXNpemU6MTAwJSAxMDAlfX0jbG9nb3tkaXNwbGF5OmlubGluZS1ibG9jaztoZWlnaHQ6NTRweDt3aWR0aDoxNTBweH0KICA8L3N0eWxlPgogIDxhIGhyZWY9Ly93d3cuZ29vZ2xlLmNvbS8+PHNwYW4gaWQ9bG9nbyBhcmlhLWxhYmVsPUdvb2dsZT48L3NwYW4+PC9hPgogIDxwPjxiPjQwNC48L2I+IDxpbnM+VGhhdOKAmXMgYW4gZXJyb3IuPC9pbnM+CiAgPHA+VGhlIHJlcXVlc3RlZCBVUkwgPGNvZGU+L3Byb3h5LWdvb2dsZS10ZXN0LXBvc3Q8L2NvZGU+IHdhcyBub3QgZm91bmQgb24gdGhpcyBzZXJ2ZXIuICA8aW5zPlRoYXTigJlzIGFsbCB3ZSBrbm93LjwvaW5zPgo=",
"BodyEncoding": {
"CodePage": 65001,
"EncodingName": "Unicode (UTF-8)",
"WebName": "utf-8"
},
"UseTransformer": false,
"Headers": {
"Date": "Wed, 27 Oct 2017 18:57:40 GMT",
"Alt-Svc": "quic=\":443\"; ma=2592000; v=\"39,38,37,35\"",
"Referrer-Policy": "no-referrer",
"Connection": "close"
}
}
}

View File

@@ -0,0 +1,19 @@
{
"Guid": "873d495f-940e-4b86-a1f4-4f0fc7be8b8b",
"Priority": 4,
"Request": {
"Path": {},
"Methods": [
"get"
]
},
"Response": {
"StatusCode": 200,
"BodyDestination": "SameAsSource",
"Body": "NO PATH OR URL",
"UseTransformer": false,
"Headers": {
"Content-Type": "application/json"
}
}
}

View File

@@ -0,0 +1,23 @@
{
"Guid": "1234567A-940e-4b86-a1f4-4f0fc7be8b8b",
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/bodyasfilexmltest",
"IgnoreCase": false
}
]
},
"Methods": [
"get"
]
},
"Response": {
"StatusCode": 200,
"Headers": { "Content-Type": "application/xml" },
"BodyAsFile": "MyXmlResponse.xml",
"UseTransformer": false
}
}

View File

@@ -0,0 +1,3 @@
<xml>
<hello>world</hello>
</xml>

View File

@@ -0,0 +1,46 @@
[
{
"Title": "1",
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/mappings_static_1"
}
]
},
"Methods": [
"get"
]
},
"Response": {
"BodyAsJson": { "result": "mappings static_1" },
"Headers": {
"Content-Type": "application/json"
}
}
},
{
"Title": "2",
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/mappings_static_2"
}
]
},
"Methods": [
"get"
]
},
"Response": {
"BodyAsJson": { "result": "mappings static_2" },
"Headers": {
"Content-Type": "application/json"
}
}
}
]

View File

@@ -0,0 +1,48 @@
[
{
"Guid": "12343f31-6946-4ce7-8e6f-0237c7001000",
"Title": "1",
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/mappings_static_1"
}
]
},
"Methods": [
"get"
]
},
"Response": {
"BodyAsJson": { "result": "mappings static_1" },
"Headers": {
"Content-Type": "application/json"
}
}
},
{
"Guid": "12343f31-6946-4ce7-8e6f-0237c7002000",
"Title": "2",
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/mappings_static_2"
}
]
},
"Methods": [
"get"
]
},
"Response": {
"BodyAsJson": { "result": "mappings static_2" },
"Headers": {
"Content-Type": "application/json"
}
}
}
]

View File

@@ -43,6 +43,9 @@ namespace WireMock.Net.ConsoleApplication
public static class MainApp
{
private const string TestSchema = @"
scalar DateTime
scalar MyCustomScalar
input MessageInput {
content: String
author: String
@@ -56,6 +59,7 @@ namespace WireMock.Net.ConsoleApplication
type Mutation {
createMessage(input: MessageInput): Message
createAnotherMessage(x: MyCustomScalar, dt: DateTime): Message
updateMessage(id: ID!, input: MessageInput): Message
}
@@ -168,11 +172,12 @@ namespace WireMock.Net.ConsoleApplication
// server.AllowPartialMapping();
#if GRAPHQL
var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(int) } };
server
.Given(Request.Create()
.WithPath("/graphql")
.UsingPost()
.WithGraphQLSchema(TestSchema)
.WithGraphQLSchema(TestSchema, customScalars)
)
.RespondWith(Response.Create()
.WithBody("GraphQL is ok")
@@ -320,6 +325,23 @@ namespace WireMock.Net.ConsoleApplication
.WithHeader("Keep-Alive-Test", "stef")
);
server
.Given(Request.Create()
.UsingGet()
.WithPath("/proxy-replace")
)
.RespondWith(Response.Create()
.WithProxy(new ProxyAndRecordSettings
{
Url = "http://localhost:9999",
ReplaceSettings = new ProxyUrlReplaceSettings
{
OldValue = "old",
NewValue = "new"
}
})
);
server
.Given(Request.Create()
.WithPath("/xpath").UsingPost()

View File

@@ -1,122 +0,0 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using log4net;
using log4net.Config;
using log4net.Repository;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;
using WireMock.Settings;
namespace WireMock.Net.StandAlone.NETCoreApp;
static class Program
{
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
// private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
private static int sleepTime = 30000;
private static WireMockServer _server;
static async Task Main(string[] args)
{
//await TestAsync().ConfigureAwait(false);
//return;
XmlConfigurator.Configure(LogRepository, new FileInfo("log4net.config"));
if (!WireMockServerSettingsParser.TryParseArguments(args, Environment.GetEnvironmentVariables(), out var settings, new WireMockLog4NetLogger()))
{
return;
}
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
_server = WireMockServer.Start(settings);
//_server.Given(Request.Create().WithPath("/api/sap")
// .UsingPost()
// .WithBody((IBodyData xmlData) =>
// {
// //xmlData is always null
// return true;
// }))
// .RespondWith(Response.Create().WithStatusCode(System.Net.HttpStatusCode.OK));
//_server
// .Given(Request.Create()
// .UsingAnyMethod())
// .RespondWith(Response.Create()
// .WithTransformer()
// .WithBody("{{Random Type=\"Integer\" Min=100 Max=999999}} {{DateTime.Now}} {{DateTime.Now \"yyyy-MMM\"}} {{String.Format (DateTime.Now) \"MMM-dd\"}}"));
Console.WriteLine($"{DateTime.UtcNow} Press Ctrl+C to shut down");
Console.CancelKeyPress += (s, e) =>
{
Stop("CancelKeyPress");
};
System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += ctx =>
{
Stop("AssemblyLoadContext.Default.Unloading");
};
while (true)
{
Console.WriteLine($"{DateTime.UtcNow} WireMock.Net server running : {_server.IsStarted}");
Thread.Sleep(sleepTime);
}
}
private static void Stop(string why)
{
Console.WriteLine($"{DateTime.UtcNow} WireMock.Net server stopping because '{why}'");
_server.Stop();
Console.WriteLine($"{DateTime.UtcNow} WireMock.Net server stopped");
}
private static async Task TestAsync()
{
for (var i = 0; i < 20; i++)
{
var server = WireMockServer.Start();
server
.Given(
Request.Create().WithPath("/some/thing").UsingGet()
)
.RespondWith(
Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "text/plain")
.WithBody("Hello world! : " + i)
);
server
.Given(
Request.Create().WithPath("/some/thing").UsingGet()
)
.RespondWith(
Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "text/plain")
.WithBody("Hello world duplicate! : " + i)
);
var client = server.CreateClient();
var response = await client.GetAsync($"{server.Url}/some/thing").ConfigureAwait(false);
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
Console.WriteLine($"counter {i} value:{content}");
server.Reset();
server.Dispose();
server.Stop();
}
}
}

View File

@@ -1,16 +0,0 @@
{
"profiles": {
"WireMock.Net.StandAlone.NETCoreApp": {
"commandName": "Project",
"commandLineArgs": "--Urls http://localhost:9091 --CorsPolicyOptions AllowAll --WireMockLogger WireMockConsoleLogger"
},
"WireMock.Net.StandAlone.NETCoreAppNoPort": {
"commandName": "Project",
"commandLineArgs": "--CorsPolicyOptions AllowAll --WireMockLogger WireMockConsoleLogger"
},
"WireMock.Net.StandAlone.NETCoreAppWithHostingProtocol": {
"commandName": "Project",
"commandLineArgs": "--HostingProtocol HttpAndHttps --CorsPolicyOptions AllowAll --WireMockLogger WireMockConsoleLogger"
}
}
}

View File

@@ -1,24 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<StartupObject>WireMock.Net.StandAlone.NETCoreApp.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="log4net" Version="2.0.15" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -1,43 +0,0 @@
using System;
using log4net;
using Newtonsoft.Json;
using WireMock.Admin.Requests;
using WireMock.Logging;
namespace WireMock.Net.StandAlone.NETCoreApp;
internal class WireMockLog4NetLogger : IWireMockLogger
{
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
public void Debug(string formatString, params object[] args)
{
Log.DebugFormat(formatString, args);
}
public void Info(string formatString, params object[] args)
{
Log.InfoFormat(formatString, args);
}
public void Warn(string formatString, params object[] args)
{
Log.WarnFormat(formatString, args);
}
public void Error(string formatString, params object[] args)
{
Log.ErrorFormat(formatString, args);
}
public void Error(string message, Exception exception)
{
Log.Error(message, exception);
}
public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminRequest)
{
string message = JsonConvert.SerializeObject(logEntryModel, Formatting.Indented);
Log.DebugFormat("Admin[{0}] {1}", isAdminRequest, message);
}
}

View File

@@ -1,26 +0,0 @@
using System;
using System.IO;
using System.Linq;
using log4net.Config;
using WireMock.Server;
using WireMock.Settings;
namespace WireMock.Net.StandAlone.Net452;
public class Program
{
static void Main(params string[] args)
{
XmlConfigurator.Configure(new FileInfo("log4net.config"));
if (WireMockServerSettingsParser.TryParseArguments(args, Environment.GetEnvironmentVariables(), out var settings))
{
Console.WriteLine("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
WireMockServer.Start(settings);
Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
}
}
}

View File

@@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WireMock.Net.StandAlone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WireMock.Net.StandAlone")]
[assembly: AssemblyCopyright("Copyright © Stef Heyenrath 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("668f689e-57b4-422e-8846-c0ff643ca999")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{668F689E-57B4-422E-8846-C0FF643CA999}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WireMock.Net.StandAlone.Net452</RootNamespace>
<AssemblyName>WireMock.Net.StandAlone.Net452</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>..\..\resources\WireMock.Net-Logo.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<StartupObject>WireMock.Net.StandAlone.Net452.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.Host.HttpListener.4.0.0\lib\net451\Microsoft.Owin.Host.HttpListener.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.6\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj">
<Project>{b6269aac-170a-4346-8b9a-579ded3d9a94}</Project>
<Name>WireMock.Net.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj">
<Project>{d3804228-91f4-4502-9595-39584e5a01ad}</Project>
<Name>WireMock.Net</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger{1} - %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
</configuration>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.15" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.6" targetFramework="net452" />
<package id="Microsoft.Owin.Host.HttpListener" version="4.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net452" />
</packages>

View File

@@ -1,115 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<!--<bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" />-->
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.X509Certificates" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Win32.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.1" newVersion="4.3.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Linq.Dynamic.Core" publicKeyToken="0f07ec44de6ac832" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.12.0" newVersion="1.0.12.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Core" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.3.0" newVersion="2.1.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.3.0" newVersion="2.1.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.10.0" newVersion="2.1.10.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.9.0" newVersion="5.2.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.9.0" newVersion="5.2.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.7.0" newVersion="2.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Routing" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.2.0" newVersion="2.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.IIS" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.6.0" newVersion="2.2.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.AspNetCore.Server.IISIntegration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.1.0" newVersion="2.2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -1,22 +0,0 @@
using System;
using System.Linq;
using WireMock.Server;
using WireMock.Settings;
namespace WireMock.Net.StandAlone.Net461;
static class Program
{
static void Main(string[] args)
{
if (WireMockServerSettingsParser.TryParseArguments(args, Environment.GetEnvironmentVariables(), out var settings))
{
Console.WriteLine("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
WireMockServer.Start(settings);
Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
}
}
}

View File

@@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WireMock.Net.StandAlone.Net461")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WireMock.Net.StandAlone.Net461")]
[assembly: AssemblyCopyright("Copyright © Stef Heyenrath")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3c279524-db73-4de3-bef1-f2b2958c9f65")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,335 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props" Condition="Exists('..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3C279524-DB73-4DE3-BEF1-F2B2958C9F65}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>WireMock.Net.StandAlone.Net461</RootNamespace>
<AssemblyName>WireMock.Net.StandAlone.Net461</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>WireMock.Net.StandAlone.Net461.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Handlebars, Version=2.1.4.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661, processorArchitecture=MSIL">
<HintPath>..\..\packages\Handlebars.Net.2.1.4\lib\net46\Handlebars.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Authentication.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Authentication.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Authentication.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Authentication.Core.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Authentication.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Connections.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Connections.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Diagnostics.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Diagnostics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Diagnostics.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Diagnostics.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Diagnostics.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.HostFiltering, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.HostFiltering.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.HostFiltering.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Hosting, Version=2.2.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Hosting.2.2.7\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Hosting.Server.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Hosting.Server.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Server.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Http.2.2.2\lib\netstandard2.0\Microsoft.AspNetCore.Http.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Http.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Extensions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Http.Extensions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Features, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Http.Features.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.HttpOverrides, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.HttpOverrides.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.HttpOverrides.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Routing, Version=2.2.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Routing.2.2.2\lib\netstandard2.0\Microsoft.AspNetCore.Routing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Routing.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Routing.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Routing.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.IIS, Version=2.2.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Server.IIS.2.2.6\lib\netstandard2.0\Microsoft.AspNetCore.Server.IIS.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration, Version=2.2.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Server.IISIntegration.2.2.1\lib\netstandard2.0\Microsoft.AspNetCore.Server.IISIntegration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.Kestrel, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Server.Kestrel.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Core, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Server.Kestrel.Core.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Https, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Server.Kestrel.Https.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Https.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets, Version=2.2.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.2.2.1\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.WebUtilities, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNetCore.WebUtilities.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Binder, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.Binder.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.CommandLine, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.CommandLine.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.CommandLine.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.EnvironmentVariables.2.2.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.FileExtensions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Json, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.Json.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Json.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.UserSecrets, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.FileProviders.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.FileProviders.Physical.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.FileSystemGlobbing.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Configuration.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Console, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Console.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Console.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Debug, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.Debug.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Debug.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.EventSource, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Logging.EventSource.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.EventSource.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.ObjectPool, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.ObjectPool.2.2.0\lib\netstandard2.0\Microsoft.Extensions.ObjectPool.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Options.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options.ConfigurationExtensions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Options.ConfigurationExtensions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Net.Http.Headers, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Net.Http.Headers.2.2.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.Host.HttpListener.4.2.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.Hosting, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Owin.Hosting.4.2.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
</Reference>
<Reference Include="MimeKitLite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
<HintPath>..\..\packages\MimeKitLite.2.0.7\lib\net45\MimeKitLite.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="RestEase, Version=1.5.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\RestEase.1.5.7\lib\net452\RestEase.dll</HintPath>
</Reference>
<Reference Include="SimMetrics.Net, Version=1.0.5.0, Culture=neutral, PublicKeyToken=c58dc06d59f3391b, processorArchitecture=MSIL">
<HintPath>..\..\packages\SimMetrics.Net.1.0.5\lib\net45\SimMetrics.Net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.IO.Pipelines.4.5.3\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
</Reference>
<Reference Include="System.Linq.Dynamic.Core, Version=1.3.1.0, Culture=neutral, PublicKeyToken=0f07ec44de6ac832, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Linq.Dynamic.Core.1.3.1\lib\net46\System.Linq.Dynamic.Core.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Cng, Version=4.3.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Cng.4.5.2\lib\net461\System.Security.Cryptography.Cng.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Security.Principal.Windows, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Security.Principal.Windows.4.5.1\lib\net461\System.Security.Principal.Windows.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Text.Encodings.Web.4.5.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Http, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Core.5.2.9\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Owin, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Owin.5.2.9\lib\net45\System.Web.Http.Owin.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="XPath2, Version=1.1.3.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
<HintPath>..\..\packages\XPath2.1.1.3\lib\net452\XPath2.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj">
<Project>{b6269aac-170a-4346-8b9a-579ded3d9a94}</Project>
<Name>WireMock.Net.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj">
<Project>{D3804228-91F4-4502-9595-39584E5A01AD}</Project>
<Name>WireMock.Net</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.AspNetCore.Server.IIS.2.2.6\build\netstandard2.0\Microsoft.AspNetCore.Server.IIS.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.AspNetCore.Server.IIS.2.2.6\build\netstandard2.0\Microsoft.AspNetCore.Server.IIS.targets'))" />
<Error Condition="!Exists('..\..\packages\Microsoft.AspNetCore.Server.IISIntegration.2.2.1\build\netstandard2.0\Microsoft.AspNetCore.Server.IISIntegration.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.AspNetCore.Server.IISIntegration.2.2.1\build\netstandard2.0\Microsoft.AspNetCore.Server.IISIntegration.targets'))" />
</Target>
<Import Project="..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets" Condition="Exists('..\..\packages\Microsoft.Extensions.Configuration.UserSecrets.2.2.0\build\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets')" />
<Import Project="..\..\packages\Microsoft.AspNetCore.Server.IIS.2.2.6\build\netstandard2.0\Microsoft.AspNetCore.Server.IIS.targets" Condition="Exists('..\..\packages\Microsoft.AspNetCore.Server.IIS.2.2.6\build\netstandard2.0\Microsoft.AspNetCore.Server.IIS.targets')" />
<Import Project="..\..\packages\Microsoft.AspNetCore.Server.IISIntegration.2.2.1\build\netstandard2.0\Microsoft.AspNetCore.Server.IISIntegration.targets" Condition="Exists('..\..\packages\Microsoft.AspNetCore.Server.IISIntegration.2.2.1\build\netstandard2.0\Microsoft.AspNetCore.Server.IISIntegration.targets')" />
</Project>

View File

@@ -1,86 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Handlebars.Net" version="2.1.4" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.9" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.9" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.9" targetFramework="net461" />
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.9" targetFramework="net461" />
<package id="Microsoft.AspNetCore" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authentication.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Authentication.Core" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Connections.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Diagnostics" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Diagnostics.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.HostFiltering" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting" version="2.2.7" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Extensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Http.Features" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.HttpOverrides" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Routing" version="2.2.2" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Routing.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.IIS" version="2.2.6" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.IISIntegration" version="2.2.1" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.2.1" targetFramework="net461" />
<package id="Microsoft.AspNetCore.WebUtilities" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Binder" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.CommandLine" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="2.2.4" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.Json" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Configuration.UserSecrets" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileProviders.Physical" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.FileSystemGlobbing" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Configuration" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Console" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.Debug" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Logging.EventSource" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.ObjectPool" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Options.ConfigurationExtensions" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Extensions.Primitives" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net461" />
<package id="Microsoft.Owin" version="4.2.2" targetFramework="net461" />
<package id="Microsoft.Owin.Host.HttpListener" version="4.2.2" targetFramework="net461" />
<package id="Microsoft.Owin.Hosting" version="4.2.2" targetFramework="net461" />
<package id="MimeKitLite" version="2.0.7" targetFramework="net461" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net461" />
<package id="Owin" version="1.0" targetFramework="net461" />
<package id="RestEase" version="1.5.7" targetFramework="net461" />
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net461" />
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net461" />
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" />
<package id="System.Linq.Dynamic.Core" version="1.3.1" targetFramework="net461" />
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Cng" version="4.5.2" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Principal.Windows" version="4.5.1" targetFramework="net461" />
<package id="System.Text.Encodings.Web" version="4.5.1" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
<package id="XPath2" version="1.1.3" targetFramework="net461" />
</packages>

View File

@@ -2,13 +2,13 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Testcontainers.MsSql" Version="3.2.0" />
<PackageReference Include="Testcontainers.MsSql" Version="3.6.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,3 +1,6 @@
using System.Collections.Generic;
using System;
namespace WireMock.Admin.Mappings;
/// <summary>
@@ -75,6 +78,16 @@ public class MatcherModel
#endregion
#region XPathMatcher
/// <summary>
/// Array of namespace prefix and uri. (optional)
/// </summary>
public XmlNamespace[]? XmlNamespaceMap { get; set; }
#endregion
#region GraphQLMatcher
/// <summary>
/// Mapping of custom GraphQL Scalar name to ClrType. (optional)
/// </summary>
public IDictionary<string, Type>? CustomScalars { get; set; }
#endregion
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using WireMock.Admin.Settings;
namespace WireMock.Admin.Mappings;
@@ -103,6 +104,11 @@ public class ResponseModel
/// </summary>
public string? ProxyUrl { get; set; }
/// <summary>
/// Defines the Proxy Url Replace Settings.
/// </summary>
public ProxyUrlReplaceSettingsModel? ProxyUrlReplaceSettings { get; set; }
/// <summary>
/// The client X509Certificate2 Thumbprint or SubjectName to use.
/// </summary>

View File

@@ -70,7 +70,12 @@ public class ProxyAndRecordSettingsModel
public bool AppendGuidToSavedMappingFile { get; set; }
/// <summary>
/// Defines the Replace Settings
/// Defines the Replace Settings.
/// </summary>
public ProxyUrlReplaceSettingsModel? ReplaceSettings { get; set; }
/// <summary>
/// Proxy all Api calls, irrespective of any condition
/// </summary>
public bool ProxyAll { get; set; } = false;
}

View File

@@ -1,24 +1,23 @@
namespace WireMock.Admin.Settings
namespace WireMock.Admin.Settings;
/// <summary>
/// WebProxySettings
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class WebProxySettingsModel
{
/// <summary>
/// WebProxySettings
/// A string instance that contains the address of the proxy server.
/// </summary>
[FluentBuilder.AutoGenerateBuilder]
public class WebProxySettingsModel
{
/// <summary>
/// A string instance that contains the address of the proxy server.
/// </summary>
public string Address { get; set; }
public string Address { get; set; } = null!;
/// <summary>
/// The user name associated with the credentials.
/// </summary>
public string? UserName { get; set; }
/// <summary>
/// The user name associated with the credentials.
/// </summary>
public string? UserName { get; set; }
/// <summary>
/// The password for the user name associated with the credentials.
/// </summary>
public string? Password { get; set; }
}
/// <summary>
/// The password for the user name associated with the credentials.
/// </summary>
public string? Password { get; set; }
}

View File

@@ -134,7 +134,7 @@ public interface IWireMockServer : IDisposable
void RemoveAuthentication();
/// <summary>
/// Resets LogEntries and Mappings.
/// Resets LogEntries, Mappings and Scenarios.
/// </summary>
void Reset();

View File

@@ -30,12 +30,12 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'" >
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">
<DefineConstants>$(DefineConstants);GRAPHQL;MIMEKIT</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<!-- See also https://mstack.nl/blog/20210801-source-generators -->

View File

@@ -30,7 +30,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

View File

@@ -159,7 +159,7 @@ internal class CSharpCodeMatcher : ICSharpCodeMatcher
throw new WireMockException("CSharpCodeMatcher: Problem calling method 'IsMatch' in WireMock.CodeHelper", ex);
}
#elif (NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0)
#elif (NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0_OR_GREATER)
Assembly assembly;
try
{

View File

@@ -4,7 +4,7 @@
<Description>A CSharpCodeMatcher which can be used to match WireMock.Net Requests using C# code.</Description>
<AssemblyTitle>WireMock.Net.Matchers.CSharpCode</AssemblyTitle>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>wiremock;matchers;matcher;csharp;csharpcode</PackageTags>
<RootNamespace>WireMock</RootNamespace>
@@ -31,7 +31,7 @@
<Target Name="CheckIfShouldKillVBCSCompiler" />
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<ProjectReference Include="..\WireMock.Net\WireMock.Net.csproj" />
@@ -45,7 +45,7 @@
<PackageReference Include="CS-Script" Version="3.30.3" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="CS-Script" Version="4.4.2" />
</ItemGroup>

View File

@@ -27,7 +27,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RamlToOpenApiConverter" Version="0.6.1" />
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.17" />
<PackageReference Include="Stef.Validation" Version="0.1.1" />

View File

@@ -3,7 +3,7 @@
<Description>Lightweight StandAlone Http Mocking Server for .Net.</Description>
<AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>WireMock.Net.StandAlone</AssemblyName>
<PackageId>WireMock.Net.StandAlone</PackageId>
@@ -36,7 +36,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

View File

@@ -29,8 +29,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Stef.Validation" Version="0.1.1" />
<PackageReference Include="Testcontainers" Version="3.2.0" />
<PackageReference Include="JetBrains.Annotations" VersionOverride="2022.3.1" PrivateAssets="All" Version="2022.3.1" />
<PackageReference Include="Testcontainers" Version="3.6.0" />
<PackageReference Include="JetBrains.Annotations" VersionOverride="2022.3.1" PrivateAssets="All" Version="2023.3.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -9,7 +9,7 @@ internal static class HttpClientBuilder
{
public static HttpClient Build(HttpClientSettings settings)
{
#if NETSTANDARD || NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
#if NETSTANDARD || NETCOREAPP3_1 || NET5_0_OR_GREATER
var handler = new HttpClientHandler
{
CheckCertificateRevocationList = false,

View File

@@ -6,10 +6,15 @@ using System.Linq;
using AnyOfTypes;
using GraphQL;
using GraphQL.Types;
using GraphQLParser;
using GraphQLParser.AST;
using Newtonsoft.Json;
using Stef.Validation;
using WireMock.Exceptions;
using WireMock.Extensions;
using WireMock.Matchers.Models;
using WireMock.Models;
using WireMock.Util;
namespace WireMock.Matchers;
@@ -36,14 +41,40 @@ public class GraphQLMatcher : IStringMatcher
public MatchBehaviour MatchBehaviour { get; }
/// <summary>
/// Initializes a new instance of the <see cref="LinqMatcher"/> class.
/// An optional dictionary defining the custom Scalar and the type.
/// </summary>
public IDictionary<string, Type>? CustomScalars { get; }
/// <summary>
/// Initializes a new instance of the <see cref="GraphQLMatcher"/> class.
/// </summary>
/// <param name="schema">The schema.</param>
/// <param name="matchBehaviour">The match behaviour.</param>
/// <param name="matchBehaviour">The match behaviour. (default = "AcceptOnMatch")</param>
/// <param name="matchOperator">The <see cref="Matchers.MatchOperator"/> to use. (default = "Or")</param>
public GraphQLMatcher(AnyOf<string, StringPattern, ISchema> schema, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch, MatchOperator matchOperator = MatchOperator.Or)
public GraphQLMatcher(
AnyOf<string, StringPattern, ISchema> schema,
MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch,
MatchOperator matchOperator = MatchOperator.Or
) : this(schema, null, matchBehaviour, matchOperator)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GraphQLMatcher"/> class.
/// </summary>
/// <param name="schema">The schema.</param>
/// <param name="customScalars">A dictionary defining the custom scalars used in this schema. (optional)</param>
/// <param name="matchBehaviour">The match behaviour. (default = "AcceptOnMatch")</param>
/// <param name="matchOperator">The <see cref="Matchers.MatchOperator"/> to use. (default = "Or")</param>
public GraphQLMatcher(
AnyOf<string, StringPattern, ISchema> schema,
IDictionary<string, Type>? customScalars,
MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch,
MatchOperator matchOperator = MatchOperator.Or
)
{
Guard.NotNull(schema);
CustomScalars = customScalars;
MatchBehaviour = matchBehaviour;
MatchOperator = matchOperator;
@@ -137,12 +168,36 @@ public class GraphQLMatcher : IStringMatcher
}
}
private static ISchema BuildSchema(string typeDefinitions)
/// <param name="typeDefinitions">A textual description of the schema in SDL (Schema Definition Language) format.</param>
private ISchema BuildSchema(string typeDefinitions)
{
var schema = Schema.For(typeDefinitions);
// #984
schema.RegisterTypes(schema.BuiltInTypeMappings.Select(x => x.graphType).ToArray());
var graphTypes = schema.BuiltInTypeMappings.Select(tm => tm.graphType).ToArray();
schema.RegisterTypes(graphTypes);
var doc = Parser.Parse(typeDefinitions);
var scalarTypeDefinitions = doc.Definitions
.Where(d => d.Kind == ASTNodeKind.ScalarTypeDefinition)
.OfType<GraphQLTypeDefinition>();
foreach (var scalarTypeDefinitionName in scalarTypeDefinitions.Select(s => s.Name.StringValue))
{
var customScalarGraphTypeName = $"{scalarTypeDefinitionName}GraphType";
if (graphTypes.All(t => t.Name != customScalarGraphTypeName)) // Only process when not built-in.
{
// Check if this custom Scalar is defined in the dictionary
if (CustomScalars == null || !CustomScalars.TryGetValue(scalarTypeDefinitionName, out var clrType))
{
throw new WireMockException($"The GraphQL Scalar type '{scalarTypeDefinitionName}' is not defined in the CustomScalars dictionary.");
}
// Create a this custom Scalar GraphType (extending the WireMockCustomScalarGraphType<{clrType}> class)
var customScalarGraphType = ReflectionUtils.CreateGenericType(customScalarGraphTypeName, typeof(WireMockCustomScalarGraphType<>), clrType);
schema.RegisterType(customScalarGraphType);
}
}
return schema;
}

View File

@@ -0,0 +1,30 @@
#if GRAPHQL
using System;
using GraphQL.Types;
namespace WireMock.Matchers.Models;
/// <inheritdoc />
public abstract class WireMockCustomScalarGraphType<T> : ScalarGraphType
{
/// <inheritdoc />
public override object? ParseValue(object? value)
{
switch (value)
{
case null:
return null;
case T:
return value;
}
if (value is string && typeof(T) != typeof(string))
{
throw new InvalidCastException($"Unable to convert value '{value}' of type '{typeof(string)}' to type '{typeof(T)}'.");
}
return (T)Convert.ChangeType(value, typeof(T));
}
}
#endif

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Stef.Validation;
@@ -25,8 +26,9 @@ public class RequestMessageGraphQLMatcher : IRequestMatcher
/// </summary>
/// <param name="matchBehaviour">The match behaviour.</param>
/// <param name="schema">The schema.</param>
public RequestMessageGraphQLMatcher(MatchBehaviour matchBehaviour, string schema) :
this(CreateMatcherArray(matchBehaviour, schema))
/// <param name="customScalars">A dictionary defining the custom scalars used in this schema. (optional)</param>
public RequestMessageGraphQLMatcher(MatchBehaviour matchBehaviour, string schema, IDictionary<string, Type>? customScalars = null) :
this(CreateMatcherArray(matchBehaviour, schema, customScalars))
{
}
@@ -36,8 +38,9 @@ public class RequestMessageGraphQLMatcher : IRequestMatcher
/// </summary>
/// <param name="matchBehaviour">The match behaviour.</param>
/// <param name="schema">The schema.</param>
public RequestMessageGraphQLMatcher(MatchBehaviour matchBehaviour, GraphQL.Types.ISchema schema) :
this(CreateMatcherArray(matchBehaviour, new AnyOfTypes.AnyOf<string, Models.StringPattern, GraphQL.Types.ISchema>(schema)))
/// <param name="customScalars">A dictionary defining the custom scalars used in this schema. (optional)</param>
public RequestMessageGraphQLMatcher(MatchBehaviour matchBehaviour, GraphQL.Types.ISchema schema, IDictionary<string, Type>? customScalars = null) :
this(CreateMatcherArray(matchBehaviour, new AnyOfTypes.AnyOf<string, WireMock.Models.StringPattern, GraphQL.Types.ISchema>(schema), customScalars))
{
}
#endif
@@ -89,12 +92,17 @@ public class RequestMessageGraphQLMatcher : IRequestMatcher
}
#if GRAPHQL
private static IMatcher[] CreateMatcherArray(MatchBehaviour matchBehaviour, AnyOfTypes.AnyOf<string, Models.StringPattern, GraphQL.Types.ISchema> schema)
private static IMatcher[] CreateMatcherArray(
MatchBehaviour matchBehaviour,
AnyOfTypes.AnyOf<string, WireMock.Models.StringPattern,
GraphQL.Types.ISchema> schema,
IDictionary<string, Type>? customScalars
)
{
return new[] { new GraphQLMatcher(schema, matchBehaviour) }.Cast<IMatcher>().ToArray();
return new[] { new GraphQLMatcher(schema, customScalars, matchBehaviour) }.Cast<IMatcher>().ToArray();
}
#else
private static IMatcher[] CreateMatcherArray(MatchBehaviour matchBehaviour, object schema)
private static IMatcher[] CreateMatcherArray(MatchBehaviour matchBehaviour, object schema, IDictionary<string, Type>? customScalars)
{
throw new System.NotSupportedException("The GrapQLMatcher can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower.");
}

View File

@@ -1,4 +1,4 @@
#if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
#if NETCOREAPP3_1 || NET5_0_OR_GREATER
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using WireMock.Types;

View File

@@ -72,7 +72,7 @@ namespace WireMock.Owin
services.AddSingleton<IOwinResponseMapper, OwinResponseMapper>();
services.AddSingleton<IGuidUtils, GuidUtils>();
#if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
#if NETCOREAPP3_1 || NET5_0_OR_GREATER
AddCors(services);
#endif
_wireMockMiddlewareOptions.AdditionalServiceRegistration?.Invoke(services);
@@ -81,7 +81,7 @@ namespace WireMock.Owin
{
appBuilder.UseMiddleware<GlobalExceptionMiddleware>();
#if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
#if NETCOREAPP3_1 || NET5_0_OR_GREATER
UseCors(appBuilder);
#endif
_wireMockMiddlewareOptions.PreWireMockMiddlewareInit?.Invoke(appBuilder);
@@ -142,6 +142,8 @@ namespace WireMock.Owin
_logger.Info("Server using .NET 6.0");
#elif NET7_0
_logger.Info("Server using .NET 7.0");
#elif NET8_0
_logger.Info("Server using .NET 8.0");
#elif NET46
_logger.Info("Server using .NET Framework 4.6.1 or higher");
#endif

View File

@@ -77,4 +77,6 @@ internal interface IWireMockMiddlewareOptions
bool? DoNotSaveDynamicResponseInLogEntry { get; set; }
QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; }
public bool ProxyAll { get; set; }
}

View File

@@ -95,4 +95,7 @@ internal class WireMockMiddlewareOptions : IWireMockMiddlewareOptions
/// <inheritdoc />
public QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; }
/// <inheritdoc />
public bool ProxyAll { get; set; }
}

View File

@@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using WireMock.Matchers;
namespace WireMock.RequestBuilders;
@@ -15,6 +17,15 @@ public interface IGraphQLRequestBuilder : IMultiPartRequestBuilder
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
IRequestBuilder WithGraphQLSchema(string schema, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch);
/// <summary>
/// WithGraphQLSchema: The GraphQL schema as a string.
/// </summary>
/// <param name="schema">The GraphQL schema.</param>
/// <param name="customScalars">A dictionary defining the custom scalars used in this schema. (optional)</param>
/// <param name="matchBehaviour">The match behaviour. (Default is <c>MatchBehaviour.AcceptOnMatch</c>).</param>
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
IRequestBuilder WithGraphQLSchema(string schema, IDictionary<string, Type>? customScalars, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch);
#if GRAPHQL
/// <summary>
/// WithGraphQLSchema: The GraphQL schema as a ISchema.
@@ -23,5 +34,14 @@ public interface IGraphQLRequestBuilder : IMultiPartRequestBuilder
/// <param name="matchBehaviour">The match behaviour. (Default is <c>MatchBehaviour.AcceptOnMatch</c>).</param>
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
IRequestBuilder WithGraphQLSchema(GraphQL.Types.ISchema schema, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch);
/// <summary>
/// WithGraphQLSchema: The GraphQL schema as a ISchema.
/// </summary>
/// <param name="schema">The GraphQL schema.</param>
/// <param name="customScalars">A dictionary defining the custom scalars used in this schema. (optional)</param>
/// <param name="matchBehaviour">The match behaviour. (Default is <c>MatchBehaviour.AcceptOnMatch</c>).</param>
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
IRequestBuilder WithGraphQLSchema(GraphQL.Types.ISchema schema, IDictionary<string, Type>? customScalars, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch);
#endif
}

View File

@@ -1,3 +1,5 @@
using System.Collections.Generic;
using System;
using WireMock.Matchers;
using WireMock.Matchers.Request;
@@ -12,6 +14,13 @@ public partial class Request
return this;
}
/// <inheritdoc />
public IRequestBuilder WithGraphQLSchema(string schema, IDictionary<string, Type>? customScalars, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
{
_requestMatchers.Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema, customScalars));
return this;
}
#if GRAPHQL
/// <inheritdoc />
public IRequestBuilder WithGraphQLSchema(GraphQL.Types.ISchema schema, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
@@ -19,5 +28,12 @@ public partial class Request
_requestMatchers.Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema));
return this;
}
/// <inheritdoc />
public IRequestBuilder WithGraphQLSchema(GraphQL.Types.ISchema schema, IDictionary<string, Type>? customScalars, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
{
_requestMatchers.Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema, customScalars));
return this;
}
#endif
}

View File

@@ -373,9 +373,11 @@ internal class MappingConverter
mappingModel.Response.UseTransformerForBodyAsFile = null;
mappingModel.Response.TransformerReplaceNodeOptions = null;
mappingModel.Response.BodyEncoding = null;
mappingModel.Response.ProxyUrl = response.ProxyAndRecordSettings.Url;
mappingModel.Response.Fault = null;
mappingModel.Response.WebProxy = MapWebProxy(response.ProxyAndRecordSettings.WebProxySettings);
mappingModel.Response.WebProxy = TinyMapperUtils.Instance.Map(response.ProxyAndRecordSettings.WebProxySettings);
mappingModel.Response.ProxyUrl = response.ProxyAndRecordSettings.Url;
mappingModel.Response.ProxyUrlReplaceSettings = TinyMapperUtils.Instance.Map(response.ProxyAndRecordSettings.ReplaceSettings);
}
else
{
@@ -509,16 +511,6 @@ internal class MappingConverter
return values is { } ? string.Join(", ", values.Select(ToCSharpStringLiteral)) : ToCSharpStringLiteral(defaultValue);
}
private static WebProxyModel? MapWebProxy(WebProxySettings? settings)
{
return settings != null ? new WebProxyModel
{
Address = settings.Address,
UserName = settings.UserName,
Password = settings.Password
} : null;
}
private static IDictionary<string, object> MapHeaders(IDictionary<string, WireMockList<string>> dictionary)
{
var newDictionary = new Dictionary<string, object>();

View File

@@ -72,7 +72,7 @@ internal class MatcherMapper
return CreateExactObjectMatcher(matchBehaviour, stringPatterns[0]);
#if GRAPHQL
case nameof(GraphQLMatcher):
return new GraphQLMatcher(stringPatterns[0].GetPattern(), matchBehaviour, matchOperator);
return new GraphQLMatcher(stringPatterns[0].GetPattern(), matcher.CustomScalars, matchBehaviour, matchOperator);
#endif
#if MIMEKIT
@@ -101,8 +101,7 @@ internal class MatcherMapper
return new JmesPathMatcher(matchBehaviour, matchOperator, stringPatterns);
case nameof(XPathMatcher):
var xmlNamespaces = matcher.XmlNamespaceMap;
return new XPathMatcher(matchBehaviour, matchOperator, xmlNamespaces, stringPatterns);
return new XPathMatcher(matchBehaviour, matchOperator, matcher.XmlNamespaceMap, stringPatterns);
case nameof(WildcardMatcher):
return new WildcardMatcher(matchBehaviour, stringPatterns, ignoreCase, matchOperator);
@@ -164,6 +163,11 @@ internal class MatcherMapper
case XPathMatcher xpathMatcher:
model.XmlNamespaceMap = xpathMatcher.XmlNamespaceMap;
break;
#if GRAPHQL
case GraphQLMatcher graphQLMatcher:
model.CustomScalars = graphQLMatcher.CustomScalars;
break;
#endif
}
switch (matcher)

View File

@@ -280,12 +280,8 @@ public partial class WireMockServer
{
Url = responseModel.ProxyUrl!,
ClientX509Certificate2ThumbprintOrSubjectName = responseModel.X509Certificate2ThumbprintOrSubjectName,
WebProxySettings = responseModel.WebProxy != null ? new WebProxySettings
{
Address = responseModel.WebProxy.Address,
UserName = responseModel.WebProxy.UserName,
Password = responseModel.WebProxy.Password
} : null
WebProxySettings = TinyMapperUtils.Instance.Map(responseModel.WebProxy),
ReplaceSettings = TinyMapperUtils.Instance.Map(responseModel.ProxyUrlReplaceSettings)
};
return responseBuilder.WithProxy(proxyAndRecordSettings);

View File

@@ -10,7 +10,7 @@ using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Util;
using Stef.Validation;
using OrgMappings = WireMock.Org.Abstractions.Mappings;
using OrgMapping = WireMock.Org.Abstractions.Mapping;
namespace WireMock.Server;
@@ -25,14 +25,14 @@ public partial class WireMockServer
{
Guard.NotNull(path, nameof(path));
string filenameWithoutExtension = Path.GetFileNameWithoutExtension(path);
var filenameWithoutExtension = Path.GetFileNameWithoutExtension(path);
if (FileHelper.TryReadMappingFileWithRetryAndDelay(_settings.FileSystemHandler, path, out var value))
{
var mappings = DeserializeJsonToArray<OrgMappings>(value);
var mappings = DeserializeJsonToArray<OrgMapping>(value);
foreach (var mapping in mappings)
{
if (mappings.Length == 1 && Guid.TryParse(filenameWithoutExtension, out Guid guidFromFilename))
if (mappings.Length == 1 && Guid.TryParse(filenameWithoutExtension, out var guidFromFilename))
{
ConvertWireMockOrgMappingAndRegisterAsRespondProvider(mapping, guidFromFilename, path);
}
@@ -48,10 +48,10 @@ public partial class WireMockServer
{
try
{
var mappingModels = DeserializeRequestMessageToArray<OrgMappings>(requestMessage);
var mappingModels = DeserializeRequestMessageToArray<OrgMapping>(requestMessage);
if (mappingModels.Length == 1)
{
Guid? guid = ConvertWireMockOrgMappingAndRegisterAsRespondProvider(mappingModels[0]);
var guid = ConvertWireMockOrgMappingAndRegisterAsRespondProvider(mappingModels[0]);
return ResponseMessageBuilder.Create(201, "Mapping added", guid);
}
@@ -74,7 +74,7 @@ public partial class WireMockServer
}
}
private Guid? ConvertWireMockOrgMappingAndRegisterAsRespondProvider(OrgMappings mapping, Guid? guid = null, string? path = null)
private Guid? ConvertWireMockOrgMappingAndRegisterAsRespondProvider(Org.Abstractions.Mapping mapping, Guid? guid = null, string? path = null)
{
var requestBuilder = Request.Create();
@@ -159,7 +159,7 @@ public partial class WireMockServer
}
}
IResponseBuilder responseBuilder = Response.Create();
var responseBuilder = Response.Create();
var response = mapping.Response;
if (response != null)

View File

@@ -31,6 +31,11 @@ public partial class WireMockServer
proxyRespondProvider.AtPriority(WireMockConstants.ProxyPriority);
}
if(settings.ProxyAndRecordSettings.ProxyAll)
{
proxyRespondProvider.AtPriority(int.MinValue);
}
proxyRespondProvider.RespondWith(new ProxyAsyncResponseProvider(ProxyAndRecordAsync, settings));
}

View File

@@ -427,6 +427,8 @@ public partial class WireMockServer : IWireMockServer
{
ResetLogEntries();
ResetScenarios();
ResetMappings();
}

View File

@@ -94,4 +94,10 @@ public class ProxyAndRecordSettings : HttpClientSettings
/// Append an unique GUID to the filename from the saved mapping file.
/// </summary>
public bool AppendGuidToSavedMappingFile { get; set; }
/// <summary>
/// Proxy all Api calls, irrespective of any condition
/// </summary>
[PublicAPI]
public bool ProxyAll { get; set; } = false;
}

View File

@@ -125,7 +125,8 @@ public static class WireMockServerSettingsParser
{
StatusCodePattern = parser.GetStringValue("SaveMappingForStatusCodePattern", "*"),
// HttpMethods = new ProxySaveMappingSetting<string[]>(parser.GetValues("DoNotSaveMappingForHttpMethods", new string[0]), MatchBehaviour.RejectOnMatch)
}
},
ProxyAll = parser.GetBoolValue(nameof(ProxyAndRecordSettings.ProxyAll))
};
ParseWebProxyAddressSettings(proxyAndRecordSettings, parser);

View File

@@ -5,7 +5,6 @@ using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Stef.Validation;
using WireMock.ResponseBuilders;
using WireMock.Settings;
using WireMock.Types;
using WireMock.Util;
@@ -250,7 +249,7 @@ internal class Transformer : ITransformer
return;
}
var transformed = transformerContext.ParseAndEvaluate(stringValue, model);
var transformed = transformerContext.ParseAndEvaluate(stringValue!, model);
if (!Equals(stringValue, transformed))
{
ReplaceNodeValue(options, node, transformed);

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
namespace WireMock.Util;
internal static class ReflectionUtils
{
private const string DynamicModuleName = "WireMockDynamicModule";
private static readonly AssemblyName AssemblyName = new("WireMockDynamicAssembly");
private const TypeAttributes ClassAttributes =
TypeAttributes.Public |
TypeAttributes.Class |
TypeAttributes.AutoClass |
TypeAttributes.AnsiClass |
TypeAttributes.BeforeFieldInit |
TypeAttributes.AutoLayout;
private static readonly ConcurrentDictionary<string, Type> TypeCache = new();
public static Type CreateType(string typeName, Type? parentType = null)
{
return TypeCache.GetOrAdd(typeName, key =>
{
var assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(AssemblyName, AssemblyBuilderAccess.Run);
var moduleBuilder = assemblyBuilder.DefineDynamicModule(DynamicModuleName);
var typeBuilder = moduleBuilder.DefineType(key, ClassAttributes, parentType);
// Create the type and cache it
return typeBuilder.CreateTypeInfo()!.AsType();
});
}
public static Type CreateGenericType(string typeName, Type genericTypeDefinition, params Type[] typeArguments)
{
var genericKey = $"{typeName}_{genericTypeDefinition.Name}_{string.Join(", ", typeArguments.Select(t => t.Name))}";
return TypeCache.GetOrAdd(genericKey, _ =>
{
var genericType = genericTypeDefinition.MakeGenericType(typeArguments);
// Create the type based on the genericType and cache it
return CreateType(typeName, genericType);
});
}
}

View File

@@ -1,4 +1,5 @@
using Nelibur.ObjectMapper;
using WireMock.Admin.Mappings;
using WireMock.Admin.Settings;
using WireMock.Settings;
@@ -12,10 +13,12 @@ internal sealed class TinyMapperUtils
{
TinyMapper.Bind<ProxyAndRecordSettings, ProxyAndRecordSettingsModel>();
TinyMapper.Bind<WebProxySettings, WebProxySettingsModel>();
TinyMapper.Bind<WebProxySettings, WebProxyModel>();
TinyMapper.Bind<ProxyUrlReplaceSettings, ProxyUrlReplaceSettingsModel>();
TinyMapper.Bind<ProxyAndRecordSettingsModel, ProxyAndRecordSettings>();
TinyMapper.Bind<WebProxySettingsModel, WebProxySettings>();
TinyMapper.Bind<WebProxyModel, WebProxySettings>();
TinyMapper.Bind<ProxyUrlReplaceSettingsModel, ProxyUrlReplaceSettings>();
}
@@ -28,4 +31,24 @@ internal sealed class TinyMapperUtils
{
return model == null ? null : TinyMapper.Map<ProxyAndRecordSettings>(model);
}
public ProxyUrlReplaceSettingsModel? Map(ProxyUrlReplaceSettings? instance)
{
return instance == null ? null : TinyMapper.Map<ProxyUrlReplaceSettingsModel>(instance);
}
public ProxyUrlReplaceSettings? Map(ProxyUrlReplaceSettingsModel? model)
{
return model == null ? null : TinyMapper.Map<ProxyUrlReplaceSettings>(model);
}
public WebProxyModel? Map(WebProxySettings? instance)
{
return instance == null ? null : TinyMapper.Map<WebProxyModel>(instance);
}
public WebProxySettings? Map(WebProxyModel? model)
{
return model == null ? null : TinyMapper.Map<WebProxySettings>(model);
}
}

View File

@@ -3,7 +3,7 @@
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
<AssemblyTitle>WireMock.Net</AssemblyTitle>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>WireMock.Net</AssemblyName>
<PackageId>WireMock.Net</PackageId>
@@ -38,7 +38,7 @@
<DefineConstants>$(DefineConstants);NETSTANDARD;USE_ASPNETCORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp2.2' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0'or '$(TargetFramework)' == 'net7.0' ">
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp2.2' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
<DefineConstants>$(DefineConstants);USE_ASPNETCORE</DefineConstants>
</PropertyGroup>
@@ -60,7 +60,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="JsonConverter.Abstractions" Version="0.4.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
@@ -80,7 +80,7 @@
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard1.3' ">
<PackageReference Include="XPath2.Extensions" Version="1.1.3" />
<PackageReference Include="XPath2.Extensions" Version="1.1.4" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.12.2" />
</ItemGroup>
@@ -152,7 +152,7 @@
<PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.6" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Scriban.Signed" Version="5.5.0" />
</ItemGroup>
@@ -189,13 +189,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.0" />
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.0" />
<PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.0" />
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.0" />
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.0" />
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.0" />
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.0" />
<PackageReference Include="Handlebars.Net.Helpers" Version="2.4.1.2" />
<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.1.2" />
<PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.1.2" />
<PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.1.2" />
<PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.1.2" />
<PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.1.2" />
<PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.1.2" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,9 +1,8 @@
namespace WireMock.Org.Abstractions
{
public class GetAdminMappingsResult
{
public Mappings Mappings { get; set; }
namespace WireMock.Org.Abstractions;
public Meta Meta { get; set; }
}
public class GetAdminMappingsResult
{
public Mapping[] Mappings { get; set; }
public Meta Meta { get; set; }
}

View File

@@ -0,0 +1,58 @@
namespace WireMock.Org.Abstractions;
public class Mapping
{
/// <summary>
/// This stub mapping's unique identifier
/// </summary>
public string Id { get; set; }
/// <summary>
/// Alias for the id
/// </summary>
public string Uuid { get; set; }
/// <summary>
/// The stub mapping's name
/// </summary>
public string Name { get; set; }
public MappingsRequest Request { get; set; }
public MappingsResponse Response { get; set; }
/// <summary>
/// Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.
/// </summary>
public bool Persistent { get; set; }
/// <summary>
/// This stub mapping's priority relative to others. 1 is highest.
/// </summary>
public int Priority { get; set; }
/// <summary>
/// The name of the scenario that this stub mapping is part of
/// </summary>
public string ScenarioName { get; set; }
/// <summary>
/// The required state of the scenario in order for this stub to be matched.
/// </summary>
public string RequiredScenarioState { get; set; }
/// <summary>
/// The new state for the scenario to be updated to after this stub is served.
/// </summary>
public string NewScenarioState { get; set; }
/// <summary>
/// A map of the names of post serve action extensions to trigger and their parameters.
/// </summary>
public object PostServeActions { get; set; }
/// <summary>
/// Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs.
/// </summary>
public object Metadata { get; set; }
}

View File

@@ -1,59 +0,0 @@
namespace WireMock.Org.Abstractions
{
public class Mappings
{
/// <summary>
/// This stub mapping's unique identifier
/// </summary>
public string Id { get; set; }
/// <summary>
/// Alias for the id
/// </summary>
public string Uuid { get; set; }
/// <summary>
/// The stub mapping's name
/// </summary>
public string Name { get; set; }
public MappingsRequest Request { get; set; }
public MappingsResponse Response { get; set; }
/// <summary>
/// Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.
/// </summary>
public bool Persistent { get; set; }
/// <summary>
/// This stub mapping's priority relative to others. 1 is highest.
/// </summary>
public int Priority { get; set; }
/// <summary>
/// The name of the scenario that this stub mapping is part of
/// </summary>
public string ScenarioName { get; set; }
/// <summary>
/// The required state of the scenario in order for this stub to be matched.
/// </summary>
public string RequiredScenarioState { get; set; }
/// <summary>
/// The new state for the scenario to be updated to after this stub is served.
/// </summary>
public string NewScenarioState { get; set; }
/// <summary>
/// A map of the names of post serve action extensions to trigger and their parameters.
/// </summary>
public object PostServeActions { get; set; }
/// <summary>
/// Arbitrary metadata to be used for e.g. tagging, documentation. Can also be used to find and remove stubs.
/// </summary>
public object Metadata { get; set; }
}
}

View File

@@ -1,9 +1,8 @@
namespace WireMock.Org.Abstractions
{
public class PostAdminMappingsFindByMetadataResult
{
public Mappings Mappings { get; set; }
namespace WireMock.Org.Abstractions;
public Meta Meta { get; set; }
}
public class PostAdminMappingsFindByMetadataResult
{
public Mapping[] Mappings { get; set; }
public Meta Meta { get; set; }
}

View File

@@ -1,9 +1,8 @@
namespace WireMock.Org.Abstractions
{
public class PostAdminRecordingsSnapshotResult
{
public Mappings Mappings { get; set; }
namespace WireMock.Org.Abstractions;
public Meta Meta { get; set; }
}
public class PostAdminRecordingsSnapshotResult
{
public Mapping[] Mappings { get; set; }
public Meta Meta { get; set; }
}

View File

@@ -1,9 +1,8 @@
namespace WireMock.Org.Abstractions
{
public class PostAdminRecordingsStopResult
{
public Mappings Mappings { get; set; }
namespace WireMock.Org.Abstractions;
public Meta Meta { get; set; }
}
public class PostAdminRecordingsStopResult
{
public Mapping[] Mappings { get; set; }
public Meta Meta { get; set; }
}

View File

@@ -33,7 +33,7 @@
<ItemGroup>
<!--<PackageReference Include="AnyOf" Version="0.1.0" />-->
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>

View File

@@ -1,299 +1,293 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using AnyOfTypes;
using RestEase;
using WireMock.Org.Abstractions;
namespace WireMock.Org.RestClient
namespace WireMock.Org.RestClient;
/// <summary>
/// Summary: WireMockOrg
///
/// Title : WireMock
/// Version: 2.3x
/// </summary>
public interface IWireMockOrgApi
{
/// <summary>
/// Summary: WireMockOrg
/// Get all stub mappings
///
/// Title : WireMock
/// Version: 2.33.2
/// GetAdminMappings (/__admin/mappings)
/// </summary>
public interface IWireMockOrgApi
{
/// <summary>
/// Get all stub mappings
///
/// GetAdminMappings (/__admin/mappings)
/// </summary>
/// <param name="limit">The maximum number of results to return</param>
/// <param name="offset">The start index of the results to return</param>
[Get("/__admin/mappings")]
Task<GetAdminMappingsResult> GetAdminMappingsAsync([Query] int? limit, [Query] int? offset);
/// <param name="limit">The maximum number of results to return</param>
/// <param name="offset">The start index of the results to return</param>
[Get("/__admin/mappings")]
Task<GetAdminMappingsResult> GetAdminMappingsAsync([Query] int? limit, [Query] int? offset);
/// <summary>
/// Create a new stub mapping
///
/// PostAdminMappings (/__admin/mappings)
/// </summary>
[Post("/__admin/mappings")]
[Header("Content-Type", "application/json")]
Task<PostAdminMappingsResult> PostAdminMappingsAsync();
/// <summary>
/// Create a new stub mapping
///
/// PostAdminMappings (/__admin/mappings)
/// </summary>
[Post("/__admin/mappings")]
[Header("Content-Type", "application/json")]
Task<PostAdminMappingsResult> PostAdminMappingsAsync();
/// <summary>
/// Delete all stub mappings
///
/// DeleteAdminMappings (/__admin/mappings)
/// </summary>
[Delete("/__admin/mappings")]
Task<object> DeleteAdminMappingsAsync();
/// <summary>
/// Delete all stub mappings
///
/// DeleteAdminMappings (/__admin/mappings)
/// </summary>
[Delete("/__admin/mappings")]
Task<object> DeleteAdminMappingsAsync();
/// <summary>
/// Reset stub mappings
///
/// PostAdminMappingsReset (/__admin/mappings/reset)
/// </summary>
[Post("/__admin/mappings/reset")]
Task<object> PostAdminMappingsResetAsync();
/// <summary>
/// Reset stub mappings
///
/// PostAdminMappingsReset (/__admin/mappings/reset)
/// </summary>
[Post("/__admin/mappings/reset")]
Task<object> PostAdminMappingsResetAsync();
/// <summary>
/// Persist stub mappings
///
/// PostAdminMappingsSave (/__admin/mappings/save)
/// </summary>
[Post("/__admin/mappings/save")]
Task<object> PostAdminMappingsSaveAsync();
/// <summary>
/// Persist stub mappings
///
/// PostAdminMappingsSave (/__admin/mappings/save)
/// </summary>
[Post("/__admin/mappings/save")]
Task<object> PostAdminMappingsSaveAsync();
/// <summary>
/// Get stub mapping by ID
///
/// GetAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
/// </summary>
/// <param name="stubMappingId">The UUID of stub mapping</param>
[Get("/__admin/mappings/{stubMappingId}")]
Task<Response<AnyOf<GetAdminMappingsByStubMappingIdResult, object>>> GetAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
/// <summary>
/// Get stub mapping by ID
///
/// GetAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
/// </summary>
/// <param name="stubMappingId">The UUID of stub mapping</param>
[Get("/__admin/mappings/{stubMappingId}")]
Task<Response<AnyOf<GetAdminMappingsByStubMappingIdResult, object>>> GetAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
/// <summary>
/// Update a stub mapping
///
/// PutAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
/// </summary>
/// <param name="stubMappingId">The UUID of stub mapping</param>
[Put("/__admin/mappings/{stubMappingId}")]
[Header("Content-Type", "application/json")]
Task<Response<AnyOf<PutAdminMappingsByStubMappingIdResult, object>>> PutAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
/// <summary>
/// Update a stub mapping
///
/// PutAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
/// </summary>
/// <param name="stubMappingId">The UUID of stub mapping</param>
[Put("/__admin/mappings/{stubMappingId}")]
[Header("Content-Type", "application/json")]
Task<Response<AnyOf<PutAdminMappingsByStubMappingIdResult, object>>> PutAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
/// <summary>
/// Delete a stub mapping
///
/// DeleteAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
/// </summary>
/// <param name="stubMappingId">The UUID of stub mapping</param>
[Delete("/__admin/mappings/{stubMappingId}")]
Task<object> DeleteAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
/// <summary>
/// Delete a stub mapping
///
/// DeleteAdminMappingsByStubMappingId (/__admin/mappings/{stubMappingId})
/// </summary>
/// <param name="stubMappingId">The UUID of stub mapping</param>
[Delete("/__admin/mappings/{stubMappingId}")]
Task<object> DeleteAdminMappingsByStubMappingIdAsync([Path] string stubMappingId);
/// <summary>
/// Find stubs by matching on their metadata
///
/// PostAdminMappingsFindByMetadata (/__admin/mappings/find-by-metadata)
/// </summary>
[Post("/__admin/mappings/find-by-metadata")]
[Header("Content-Type", "application/json")]
Task<PostAdminMappingsFindByMetadataResult> PostAdminMappingsFindByMetadataAsync();
/// <summary>
/// Find stubs by matching on their metadata
///
/// PostAdminMappingsFindByMetadata (/__admin/mappings/find-by-metadata)
/// </summary>
[Post("/__admin/mappings/find-by-metadata")]
[Header("Content-Type", "application/json")]
Task<PostAdminMappingsFindByMetadataResult> PostAdminMappingsFindByMetadataAsync();
/// <summary>
/// Delete stub mappings matching metadata
///
/// PostAdminMappingsRemoveByMetadata (/__admin/mappings/remove-by-metadata)
/// </summary>
[Post("/__admin/mappings/remove-by-metadata")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminMappingsRemoveByMetadataAsync();
/// <summary>
/// Delete stub mappings matching metadata
///
/// PostAdminMappingsRemoveByMetadata (/__admin/mappings/remove-by-metadata)
/// </summary>
[Post("/__admin/mappings/remove-by-metadata")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminMappingsRemoveByMetadataAsync();
/// <summary>
/// Get all requests in journal
///
/// GetAdminRequests (/__admin/requests)
/// </summary>
/// <param name="limit">The maximum number of results to return</param>
/// <param name="since">Only return logged requests after this date</param>
[Get("/__admin/requests")]
Task<object> GetAdminRequestsAsync([Query] string limit, [Query] string since);
/// <summary>
/// Get all requests in journal
///
/// GetAdminRequests (/__admin/requests)
/// </summary>
/// <param name="limit">The maximum number of results to return</param>
/// <param name="since">Only return logged requests after this date</param>
[Get("/__admin/requests")]
Task<object> GetAdminRequestsAsync([Query] string limit, [Query] string since);
/// <summary>
/// Delete all requests in journal
///
/// DeleteAdminRequests (/__admin/requests)
/// </summary>
[Delete("/__admin/requests")]
Task<object> DeleteAdminRequestsAsync();
/// <summary>
/// Delete all requests in journal
///
/// DeleteAdminRequests (/__admin/requests)
/// </summary>
[Delete("/__admin/requests")]
Task<object> DeleteAdminRequestsAsync();
/// <summary>
/// Get request by ID
///
/// GetAdminRequestsByRequestId (/__admin/requests/{requestId})
/// </summary>
/// <param name="requestId">The UUID of the logged request</param>
[Get("/__admin/requests/{requestId}")]
Task<object> GetAdminRequestsByRequestIdAsync([Path] string requestId);
/// <summary>
/// Get request by ID
///
/// GetAdminRequestsByRequestId (/__admin/requests/{requestId})
/// </summary>
/// <param name="requestId">The UUID of the logged request</param>
[Get("/__admin/requests/{requestId}")]
Task<object> GetAdminRequestsByRequestIdAsync([Path] string requestId);
/// <summary>
/// Delete request by ID
///
/// DeleteAdminRequestsByRequestId (/__admin/requests/{requestId})
/// </summary>
/// <param name="requestId">The UUID of the logged request</param>
[Delete("/__admin/requests/{requestId}")]
Task<object> DeleteAdminRequestsByRequestIdAsync([Path] string requestId);
/// <summary>
/// Delete request by ID
///
/// DeleteAdminRequestsByRequestId (/__admin/requests/{requestId})
/// </summary>
/// <param name="requestId">The UUID of the logged request</param>
[Delete("/__admin/requests/{requestId}")]
Task<object> DeleteAdminRequestsByRequestIdAsync([Path] string requestId);
/// <summary>
/// Empty the request journal
///
/// PostAdminRequestsReset (/__admin/requests/reset)
/// </summary>
[Post("/__admin/requests/reset")]
Task<object> PostAdminRequestsResetAsync();
/// <summary>
/// Empty the request journal
///
/// PostAdminRequestsReset (/__admin/requests/reset)
/// </summary>
[Post("/__admin/requests/reset")]
Task<object> PostAdminRequestsResetAsync();
/// <summary>
/// Count requests by criteria
///
/// PostAdminRequestsCount (/__admin/requests/count)
/// </summary>
[Post("/__admin/requests/count")]
[Header("Content-Type", "application/json")]
Task<PostAdminRequestsCountResult> PostAdminRequestsCountAsync();
/// <summary>
/// Count requests by criteria
///
/// PostAdminRequestsCount (/__admin/requests/count)
/// </summary>
[Post("/__admin/requests/count")]
[Header("Content-Type", "application/json")]
Task<PostAdminRequestsCountResult> PostAdminRequestsCountAsync();
/// <summary>
/// Remove requests by criteria
///
/// PostAdminRequestsRemove (/__admin/requests/remove)
/// </summary>
[Post("/__admin/requests/remove")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRequestsRemoveAsync();
/// <summary>
/// Remove requests by criteria
///
/// PostAdminRequestsRemove (/__admin/requests/remove)
/// </summary>
[Post("/__admin/requests/remove")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRequestsRemoveAsync();
/// <summary>
/// Delete requests mappings matching metadata
///
/// PostAdminRequestsRemoveByMetadata (/__admin/requests/remove-by-metadata)
/// </summary>
[Post("/__admin/requests/remove-by-metadata")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRequestsRemoveByMetadataAsync();
/// <summary>
/// Delete requests mappings matching metadata
///
/// PostAdminRequestsRemoveByMetadata (/__admin/requests/remove-by-metadata)
/// </summary>
[Post("/__admin/requests/remove-by-metadata")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRequestsRemoveByMetadataAsync();
/// <summary>
/// Find requests by criteria
///
/// PostAdminRequestsFind (/__admin/requests/find)
/// </summary>
[Post("/__admin/requests/find")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRequestsFindAsync();
/// <summary>
/// Find requests by criteria
///
/// PostAdminRequestsFind (/__admin/requests/find)
/// </summary>
[Post("/__admin/requests/find")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRequestsFindAsync();
/// <summary>
/// Find unmatched requests
///
/// GetAdminRequestsUnmatched (/__admin/requests/unmatched)
/// </summary>
[Get("/__admin/requests/unmatched")]
Task<object> GetAdminRequestsUnmatchedAsync();
/// <summary>
/// Find unmatched requests
///
/// GetAdminRequestsUnmatched (/__admin/requests/unmatched)
/// </summary>
[Get("/__admin/requests/unmatched")]
Task<object> GetAdminRequestsUnmatchedAsync();
/// <summary>
/// Retrieve near-misses for all unmatched requests
///
/// GetAdminRequestsUnmatchedNearMisses (/__admin/requests/unmatched/near-misses)
/// </summary>
[Get("/__admin/requests/unmatched/near-misses")]
Task<GetAdminRequestsUnmatchedNearMissesResult> GetAdminRequestsUnmatchedNearMissesAsync();
/// <summary>
/// Retrieve near-misses for all unmatched requests
///
/// GetAdminRequestsUnmatchedNearMisses (/__admin/requests/unmatched/near-misses)
/// </summary>
[Get("/__admin/requests/unmatched/near-misses")]
Task<GetAdminRequestsUnmatchedNearMissesResult> GetAdminRequestsUnmatchedNearMissesAsync();
/// <summary>
/// Find near misses matching specific request
///
/// PostAdminNearMissesRequest (/__admin/near-misses/request)
/// </summary>
[Post("/__admin/near-misses/request")]
[Header("Content-Type", "application/json")]
Task<PostAdminNearMissesRequestResult> PostAdminNearMissesRequestAsync();
/// <summary>
/// Find near misses matching specific request
///
/// PostAdminNearMissesRequest (/__admin/near-misses/request)
/// </summary>
[Post("/__admin/near-misses/request")]
[Header("Content-Type", "application/json")]
Task<PostAdminNearMissesRequestResult> PostAdminNearMissesRequestAsync();
/// <summary>
/// Find near misses matching request pattern
///
/// PostAdminNearMissesRequestPattern (/__admin/near-misses/request-pattern)
/// </summary>
[Post("/__admin/near-misses/request-pattern")]
[Header("Content-Type", "application/json")]
Task<PostAdminNearMissesRequestPatternResult> PostAdminNearMissesRequestPatternAsync();
/// <summary>
/// Find near misses matching request pattern
///
/// PostAdminNearMissesRequestPattern (/__admin/near-misses/request-pattern)
/// </summary>
[Post("/__admin/near-misses/request-pattern")]
[Header("Content-Type", "application/json")]
Task<PostAdminNearMissesRequestPatternResult> PostAdminNearMissesRequestPatternAsync();
/// <summary>
/// Start recording
///
/// PostAdminRecordingsStart (/__admin/recordings/start)
/// </summary>
[Post("/__admin/recordings/start")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRecordingsStartAsync();
/// <summary>
/// Start recording
///
/// PostAdminRecordingsStart (/__admin/recordings/start)
/// </summary>
[Post("/__admin/recordings/start")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminRecordingsStartAsync();
/// <summary>
/// Stop recording
///
/// PostAdminRecordingsStop (/__admin/recordings/stop)
/// </summary>
[Post("/__admin/recordings/stop")]
Task<PostAdminRecordingsStopResult> PostAdminRecordingsStopAsync();
/// <summary>
/// Stop recording
///
/// PostAdminRecordingsStop (/__admin/recordings/stop)
/// </summary>
[Post("/__admin/recordings/stop")]
Task<PostAdminRecordingsStopResult> PostAdminRecordingsStopAsync();
/// <summary>
/// Get recording status
///
/// GetAdminRecordingsStatus (/__admin/recordings/status)
/// </summary>
[Get("/__admin/recordings/status")]
Task<GetAdminRecordingsStatusResult> GetAdminRecordingsStatusAsync();
/// <summary>
/// Get recording status
///
/// GetAdminRecordingsStatus (/__admin/recordings/status)
/// </summary>
[Get("/__admin/recordings/status")]
Task<GetAdminRecordingsStatusResult> GetAdminRecordingsStatusAsync();
/// <summary>
/// Take a snapshot recording
///
/// PostAdminRecordingsSnapshot (/__admin/recordings/snapshot)
/// </summary>
[Post("/__admin/recordings/snapshot")]
[Header("Content-Type", "application/json")]
Task<PostAdminRecordingsSnapshotResult> PostAdminRecordingsSnapshotAsync();
/// <summary>
/// Take a snapshot recording
///
/// PostAdminRecordingsSnapshot (/__admin/recordings/snapshot)
/// </summary>
[Post("/__admin/recordings/snapshot")]
[Header("Content-Type", "application/json")]
Task<PostAdminRecordingsSnapshotResult> PostAdminRecordingsSnapshotAsync();
/// <summary>
/// Get all scenarios
///
/// GetAdminScenarios (/__admin/scenarios)
/// </summary>
[Get("/__admin/scenarios")]
Task<GetAdminScenariosResult> GetAdminScenariosAsync();
/// <summary>
/// Get all scenarios
///
/// GetAdminScenarios (/__admin/scenarios)
/// </summary>
[Get("/__admin/scenarios")]
Task<GetAdminScenariosResult> GetAdminScenariosAsync();
/// <summary>
/// Reset the state of all scenarios
///
/// PostAdminScenariosReset (/__admin/scenarios/reset)
/// </summary>
[Post("/__admin/scenarios/reset")]
Task<object> PostAdminScenariosResetAsync();
/// <summary>
/// Reset the state of all scenarios
///
/// PostAdminScenariosReset (/__admin/scenarios/reset)
/// </summary>
[Post("/__admin/scenarios/reset")]
Task<object> PostAdminScenariosResetAsync();
/// <summary>
/// Update global settings
///
/// PostAdminSettings (/__admin/settings)
/// </summary>
[Post("/__admin/settings")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminSettingsAsync();
/// <summary>
/// Update global settings
///
/// PostAdminSettings (/__admin/settings)
/// </summary>
[Post("/__admin/settings")]
[Header("Content-Type", "application/json")]
Task<object> PostAdminSettingsAsync();
/// <summary>
/// Reset mappings and request journal
///
/// PostAdminReset (/__admin/reset)
/// </summary>
[Post("/__admin/reset")]
Task<object> PostAdminResetAsync();
/// <summary>
/// Reset mappings and request journal
///
/// PostAdminReset (/__admin/reset)
/// </summary>
[Post("/__admin/reset")]
Task<object> PostAdminResetAsync();
/// <summary>
/// Shutdown the WireMock server
///
/// PostAdminShutdown (/__admin/shutdown)
/// </summary>
[Post("/__admin/shutdown")]
Task<object> PostAdminShutdownAsync();
}
/// <summary>
/// Shutdown the WireMock server
///
/// PostAdminShutdown (/__admin/shutdown)
/// </summary>
[Post("/__admin/shutdown")]
Task<object> PostAdminShutdownAsync();
}

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<PackAsTool>true</PackAsTool>
<ToolCommandName>dotnet-wiremock</ToolCommandName>
<Description>A dotnet commandline tool for WireMock.Net (A Lightweight Http Mocking Server for .NET)</Description>
@@ -16,8 +16,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,7 +1,10 @@
#if GRAPHQL
using System;
using System.Collections.Generic;
using CSScripting;
using FluentAssertions;
using GraphQLParser.Exceptions;
using WireMock.Exceptions;
using WireMock.Matchers;
using WireMock.Models;
using Xunit;
@@ -99,6 +102,62 @@ public class GraphQLMatcherTests
matcher.GetPatterns().Should().Contain(TestSchema);
}
[Fact]
public void GraphQLMatcher_For_ValidSchema_And_CorrectGraphQL_UsingCustomType_Mutation_IsMatch()
{
// Arrange
const string testSchema = @"
scalar DateTime
scalar MyCustomScalar
type Message {
id: ID!
}
type Mutation {
createMessage(x: MyCustomScalar, dt: DateTime): Message
}";
var input = @"{
""query"": ""mutation CreateMessage($x: MyCustomScalar!, $dt: DateTime!) { createMessage(x: $x, dt: $dt) { id } }"",
""variables"": { ""x"": 100, ""dt"": ""2007-12-03T10:15:30Z"" }
}";
var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(int) } };
// Act
var matcher = new GraphQLMatcher(testSchema, customScalars);
var result = matcher.IsMatch(input);
// Assert
result.Score.Should().Be(MatchScores.Perfect);
matcher.GetPatterns().Should().Contain(testSchema);
}
[Fact]
public void GraphQLMatcher_For_ValidSchema_And_CorrectGraphQL_UsingCustomType_But_NoDefinedCustomScalars_Mutation_IsNoMatch()
{
// Arrange
const string testSchema = @"
scalar DateTime
scalar MyCustomScalar
type Message {
id: ID!
}
type Mutation {
createMessage(x: MyCustomScalar, dt: DateTime): Message
}";
// Act
Action action = () => _ = new GraphQLMatcher(testSchema);
// Assert
action.Should().Throw<WireMockException>().WithMessage("The GraphQL Scalar type 'MyCustomScalar' is not defined in the CustomScalars dictionary.");
}
[Fact]
public void GraphQLMatcher_For_ValidSchema_And_IncorrectQuery_IsMismatch()
{

View File

@@ -0,0 +1,96 @@
#if GRAPHQL
using System;
using FluentAssertions;
using WireMock.Matchers.Models;
using Xunit;
namespace WireMock.Net.Tests.Matchers.Models;
public class WireMockCustomScalarGraphTypeTests
{
private class MyIntScalarGraphType : WireMockCustomScalarGraphType<int> { }
private class MyStringScalarGraphType : WireMockCustomScalarGraphType<string> { }
[Fact]
public void ParseValue_ShouldReturnNull_When_ValueIsNull()
{
// Arrange
var intGraphType = new MyIntScalarGraphType();
// Act
var result = intGraphType.ParseValue(null);
// Assert
result.Should().BeNull();
}
[Fact]
public void ParseValue_ShouldReturnValue_When_ValueIsOfCorrectType()
{
// Arrange
var intGraphType = new MyIntScalarGraphType();
// Act
var result = intGraphType.ParseValue(5);
// Assert
result.Should().Be(5);
}
[Theory]
[InlineData("someString")]
[InlineData("100")]
public void ParseValue_ShouldThrowInvalidCastException_When_ValueIsStringAndTargetIsNotString(string stringValue)
{
// Arrange
var intGraphType = new MyIntScalarGraphType();
// Act
Action act = () => intGraphType.ParseValue(stringValue);
// Assert
act.Should().Throw<InvalidCastException>()
.WithMessage("Unable to convert value '*' of type 'System.String' to type 'System.Int32'.");
}
[Fact]
public void ParseValue_ShouldConvertValue_WhenTypeIsConvertible()
{
// Arrange
var intGraphType = new MyIntScalarGraphType();
// Act
var result = intGraphType.ParseValue(5L);
// Assert
result.Should().Be(5);
}
[Fact]
public void ParseValue_ShouldThrowException_When_ValueIsMaxLongAndTargetIsInt()
{
// Arrange
var intGraphType = new MyIntScalarGraphType();
// Act
Action act = () => intGraphType.ParseValue(long.MaxValue);
// Assert
act.Should().Throw<OverflowException>();
}
[Fact]
public void ParseValue_ShouldReturnStringValue_When_TypeIsString()
{
// Arrange
var stringGraphType = new MyStringScalarGraphType();
// Act
var result = stringGraphType.ParseValue("someString");
// Assert
result.Should().Be("someString");
}
}
#endif

View File

@@ -16,7 +16,7 @@ public class RequestMessageGraphQLMatcherTests
[Fact]
public void RequestMessageGraphQLMatcher_GetMatchingScore_BodyAsString_IStringMatcher()
{
// Assign
// Arrange
var body = new BodyData
{
BodyAsString = "b",

View File

@@ -0,0 +1,68 @@
using System;
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Newtonsoft.Json.Linq;
using WireMock.Handlers;
using WireMock.Models;
using WireMock.ResponseBuilders;
using WireMock.Settings;
using Xunit;
namespace WireMock.Net.Tests.ResponseBuilders;
public class ResponseWithHandlebarsDateTimeTests
{
private const string ClientIp = "::1";
private readonly WireMockServerSettings _settings = new();
private readonly Mock<IMapping> _mappingMock;
public ResponseWithHandlebarsDateTimeTests()
{
_mappingMock = new Mock<IMapping>();
var filesystemHandlerMock = new Mock<IFileSystemHandler>(MockBehavior.Strict);
filesystemHandlerMock.Setup(fs => fs.ReadResponseBodyAsString(It.IsAny<string>())).Returns("abc");
_settings.FileSystemHandler = filesystemHandlerMock.Object;
}
[Fact]
public async Task Response_WithBodyAsJson_ProvideResponseAsync_Handlebars_DateTime()
{
// Assign
var request = new RequestMessage(new UrlDetails("http://localhost"), "GET", ClientIp);
var responseBuilder = Response.Create()
.WithBodyAsJson(new
{
DateTimeYear = "{{ DateTime.UtcNow \"yyyy\" }}"
})
.WithTransformer();
// Act
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
// Assert
var j = JObject.FromObject(response.Message.BodyData!.BodyAsJson!);
j["DateTimeYear"]!.Value<string>().Should().Be(DateTime.Now.Year.ToString());
}
[Fact]
public async Task Response_WithBody_ProvideResponseAsync_Handlebars_DateTime()
{
// Assign
var request = new RequestMessage(new UrlDetails("http://localhost"), "GET", ClientIp);
var responseBuilder = Response.Create()
.WithBody("{\nDateTimeYear = \"{{ DateTime.UtcNow \"yyyy\" }}\"")
.WithTransformer();
// Act
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
// Assert
response.Message.BodyData!.BodyAsString.Should().Contain($"DateTimeYear = \"{DateTime.Now.Year}\"");
}
}

View File

@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Newtonsoft.Json.Linq;
using NFluent;
@@ -149,7 +150,7 @@ public class ResponseWithHandlebarsRandomTests
}
[Fact]
public async Task Response_ProvideResponseAsync_Handlebars_Random2()
public async Task Response_ProvideResponseAsync_Handlebars_Random_Integer()
{
// Assign
var request = new RequestMessage(new UrlDetails("http://localhost:1234"), "GET", ClientIp);
@@ -168,4 +169,25 @@ public class ResponseWithHandlebarsRandomTests
JObject j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
Check.That(j["Integer"].Value<int>()).IsStrictlyGreaterThan(10000000).And.IsStrictlyLessThan(99999999);
}
[Fact]
public async Task Response_ProvideResponseAsync_Handlebars_Random_Long()
{
// Assign
var request = new RequestMessage(new UrlDetails("http://localhost:1234"), "GET", ClientIp);
var responseBuilder = Response.Create()
.WithBodyAsJson(new
{
Long = "{{#Random Type=\"Long\" Min=1000000000 Max=9999999999}}{{this}}{{/Random}}",
})
.WithTransformer();
// Act
var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
// Assert
var j = JObject.FromObject(response.Message.BodyData.BodyAsJson);
j["Long"].Value<long>().Should().BeInRange(1000000000, 9999999999);
}
}

View File

@@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
using AnyOfTypes;
using FluentAssertions;
using FluentAssertions.Execution;
using Moq;
using Newtonsoft.Json;
using NFluent;
using WireMock.Admin.Mappings;
using WireMock.Handlers;
using WireMock.Matchers;
using WireMock.Models;
using WireMock.Serialization;
@@ -165,6 +169,36 @@ public class MatcherMapperTests
model.XmlNamespaceMap.Should().BeEquivalentTo(xmlNamespaceMap);
}
#if GRAPHQL
[Fact]
public void MatcherMapper_Map_GraphQLMatcher()
{
// Assign
const string testSchema = @"
scalar DateTime
scalar MyCustomScalar
type Message {
id: ID!
}
type Mutation {
createMessage(x: MyCustomScalar, dt: DateTime): Message
}";
var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(string) } };
var matcher = new GraphQLMatcher(testSchema, customScalars);
// Act
var model = _sut.Map(matcher)!;
// Assert
model.Name.Should().Be(nameof(GraphQLMatcher));
model.Pattern.Should().Be(testSchema);
model.CustomScalars.Should().BeEquivalentTo(customScalars);
}
#endif
[Fact]
public void MatcherMapper_Map_MatcherModel_Null()
{
@@ -463,26 +497,6 @@ public class MatcherMapperTests
matcher.Regex.Should().BeFalse();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_ExactMatcher_Pattern()
{
// Assign
var model = new MatcherModel
{
Name = "ExactMatcher",
Pattern = "p",
IgnoreCase = true
};
// Act
var matcher = (ExactMatcher)_sut.Map(model)!;
// Assert
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
matcher.GetPatterns().Should().Contain("p");
matcher.IgnoreCase.Should().BeTrue();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_NotNullOrEmptyMatcher()
{
@@ -585,4 +599,406 @@ public class MatcherMapperTests
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
matcher.XmlNamespaceMap.Should().BeNull();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_CSharpCodeMatcher()
{
// Assign
var model = new MatcherModel
{
Name = "CSharpCodeMatcher",
Patterns = new[] { "return it == \"x\";" }
};
var sut = new MatcherMapper(new WireMockServerSettings { AllowCSharpCodeMatcher = true });
// Act 1
var matcher1 = (ICSharpCodeMatcher)sut.Map(model)!;
// Assert 1
matcher1.Should().NotBeNull();
matcher1.IsMatch("x").Score.Should().Be(1.0d);
// Act 2
var matcher2 = (ICSharpCodeMatcher)sut.Map(model)!;
// Assert 2
matcher2.Should().NotBeNull();
matcher2.IsMatch("x").Score.Should().Be(1.0d);
}
[Fact]
public void MatcherMapper_Map_MatcherModel_CSharpCodeMatcher_NotAllowed_ThrowsException()
{
// Assign
var model = new MatcherModel
{
Name = "CSharpCodeMatcher",
Patterns = new[] { "x" }
};
var sut = new MatcherMapper(new WireMockServerSettings { AllowCSharpCodeMatcher = false });
// Act
Action action = () => sut.Map(model);
// Assert
action.Should().Throw<NotSupportedException>();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_ExactMatcher_Pattern()
{
// Assign
var model = new MatcherModel
{
Name = "ExactMatcher",
Patterns = new[] { "x" }
};
// Act
var matcher = (ExactMatcher)_sut.Map(model)!;
// Assert
matcher.GetPatterns().Should().ContainSingle("x");
}
[Fact]
public void MatcherMapper_Map_MatcherModel_ExactMatcher_Patterns()
{
// Assign
var model = new MatcherModel
{
Name = "ExactMatcher",
Patterns = new[] { "x", "y" }
};
// Act
var matcher = (ExactMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
}
[Fact]
public void MatcherMapper_Map_MatcherModel_JsonPartialMatcher_RegexFalse()
{
// Assign
var pattern = "{ \"x\": 1 }";
var model = new MatcherModel
{
Name = "JsonPartialMatcher",
Regex = false,
Pattern = pattern
};
// Act
var matcher = (JsonPartialMatcher)_sut.Map(model)!;
// Assert
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
matcher.IgnoreCase.Should().BeFalse();
matcher.Value.Should().Be(pattern);
matcher.Regex.Should().BeFalse();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_JsonPartialMatcher_RegexTrue()
{
// Assign
var pattern = "{ \"x\": 1 }";
var model = new MatcherModel
{
Name = "JsonPartialMatcher",
Regex = true,
Pattern = pattern
};
// Act
var matcher = (JsonPartialMatcher)_sut.Map(model)!;
// Assert
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
matcher.IgnoreCase.Should().BeFalse();
matcher.Value.Should().Be(pattern);
matcher.Regex.Should().BeTrue();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_ExactObjectMatcher_ValidBase64StringPattern()
{
// Assign
var model = new MatcherModel
{
Name = "ExactObjectMatcher",
Patterns = new object[] { "c3RlZg==" }
};
// Act
var matcher = (ExactObjectMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.ValueAsBytes).ContainsExactly(new byte[] { 115, 116, 101, 102 });
}
[Fact]
public void MatcherMapper_Map_MatcherModel_ExactObjectMatcher_InvalidBase64StringPattern()
{
// Assign
var model = new MatcherModel
{
Name = "ExactObjectMatcher",
Patterns = new object[] { "_" }
};
// Act & Assert
Check.ThatCode(() => _sut.Map(model)).Throws<ArgumentException>();
}
[Theory]
[InlineData(MatchOperator.Or, 1.0d)]
[InlineData(MatchOperator.And, 0.0d)]
[InlineData(MatchOperator.Average, 0.5d)]
public void MatcherMapper_Map_MatcherModel_RegexMatcher(MatchOperator matchOperator, double expected)
{
// Assign
var model = new MatcherModel
{
Name = "RegexMatcher",
Patterns = new[] { "x", "y" },
IgnoreCase = true,
MatchOperator = matchOperator.ToString()
};
// Act
var matcher = (RegexMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
var result = matcher.IsMatch("X");
result.Score.Should().Be(expected);
}
[Theory]
[InlineData(MatchOperator.Or, 1.0d)]
[InlineData(MatchOperator.And, 0.0d)]
[InlineData(MatchOperator.Average, 0.5d)]
public void MatcherMapper_Map_MatcherModel_WildcardMatcher_IgnoreCase(MatchOperator matchOperator, double expected)
{
// Assign
var model = new MatcherModel
{
Name = "WildcardMatcher",
Patterns = new[] { "x", "y" },
IgnoreCase = true,
MatchOperator = matchOperator.ToString()
};
// Act
var matcher = (WildcardMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
var result = matcher.IsMatch("X");
result.Score.Should().Be(expected);
}
[Fact]
public void MatcherMapper_Map_MatcherModel_WildcardMatcher_With_PatternAsFile()
{
// Arrange
var file = "c:\\test.txt";
var fileContent = "c";
var stringPattern = new StringPattern
{
Pattern = fileContent,
PatternAsFile = file
};
var fileSystemHandleMock = new Mock<IFileSystemHandler>();
fileSystemHandleMock.Setup(f => f.ReadFileAsString(file)).Returns(fileContent);
var model = new MatcherModel
{
Name = "WildcardMatcher",
PatternAsFile = file
};
var settings = new WireMockServerSettings
{
FileSystemHandler = fileSystemHandleMock.Object
};
var sut = new MatcherMapper(settings);
// Act
var matcher = (WildcardMatcher)sut.Map(model)!;
// Assert
matcher.GetPatterns().Should().HaveCount(1).And.Contain(new AnyOf<string, StringPattern>(stringPattern));
var result = matcher.IsMatch("c");
result.Score.Should().Be(MatchScores.Perfect);
}
[Fact]
public void MatcherMapper_Map_MatcherModel_SimMetricsMatcher()
{
// Assign
var model = new MatcherModel
{
Name = "SimMetricsMatcher",
Pattern = "x"
};
// Act
var matcher = (SimMetricsMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x");
}
[Fact]
public void MatcherMapper_Map_MatcherModel_SimMetricsMatcher_BlockDistance()
{
// Assign
var model = new MatcherModel
{
Name = "SimMetricsMatcher.BlockDistance",
Pattern = "x"
};
// Act
var matcher = (SimMetricsMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x");
}
[Fact]
public void MatcherMapper_Map_MatcherModel_SimMetricsMatcher_Throws1()
{
// Assign
var model = new MatcherModel
{
Name = "error",
Pattern = "x"
};
// Act
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_SimMetricsMatcher_Throws2()
{
// Assign
var model = new MatcherModel
{
Name = "SimMetricsMatcher.error",
Pattern = "x"
};
// Act
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_MatcherModelToCustomMatcher()
{
// Arrange
var patternModel = new CustomPathParamMatcherModel("/customer/{customerId}/document/{documentId}",
new Dictionary<string, string>(2)
{
{ "customerId", @"^[0-9]+$" },
{ "documentId", @"^[0-9a-zA-Z\-\_]+\.[a-zA-Z]+$" }
});
var model = new MatcherModel
{
Name = nameof(CustomPathParamMatcher),
Pattern = JsonConvert.SerializeObject(patternModel)
};
var settings = new WireMockServerSettings();
settings.CustomMatcherMappings = settings.CustomMatcherMappings ?? new Dictionary<string, Func<MatcherModel, IMatcher>>();
settings.CustomMatcherMappings[nameof(CustomPathParamMatcher)] = matcherModel =>
{
var matcherParams = JsonConvert.DeserializeObject<CustomPathParamMatcherModel>((string)matcherModel.Pattern!)!;
return new CustomPathParamMatcher(
matcherModel.RejectOnMatch == true ? MatchBehaviour.RejectOnMatch : MatchBehaviour.AcceptOnMatch,
matcherParams.Path,
matcherParams.PathParams
);
};
var sut = new MatcherMapper(settings);
// Act
var matcher = sut.Map(model) as CustomPathParamMatcher;
// Assert
matcher.Should().NotBeNull();
}
[Fact]
public void MatcherMapper_Map_MatcherModel_CustomMatcherToMatcherModel()
{
// Arrange
var matcher = new CustomPathParamMatcher("/customer/{customerId}/document/{documentId}",
new Dictionary<string, string>(2)
{
{ "customerId", @"^[0-9]+$" },
{ "documentId", @"^[0-9a-zA-Z\-\_]+\.[a-zA-Z]+$" }
});
// Act
var model = _sut.Map(matcher)!;
// Assert
using (new AssertionScope())
{
model.Should().NotBeNull();
model.Name.Should().Be(nameof(CustomPathParamMatcher));
var matcherParams = JsonConvert.DeserializeObject<CustomPathParamMatcherModel>((string)model.Pattern!)!;
matcherParams.Path.Should().Be("/customer/{customerId}/document/{documentId}");
matcherParams.PathParams.Should().BeEquivalentTo(new Dictionary<string, string>(2)
{
{ "customerId", @"^[0-9]+$" },
{ "documentId", @"^[0-9a-zA-Z\-\_]+\.[a-zA-Z]+$" }
});
}
}
#if GRAPHQL
[Fact]
public void MatcherMapper_Map_MatcherModel_GraphQLMatcher()
{
// Arrange
const string testSchema = @"
scalar DateTime
scalar MyCustomScalar
type Message {
id: ID!
}
type Mutation {
createMessage(x: MyCustomScalar, dt: DateTime): Message
}";
var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(string) } };
var model = new MatcherModel
{
Name = nameof(GraphQLMatcher),
Pattern = testSchema,
CustomScalars = customScalars
};
// Act
var matcher = (GraphQLMatcher)_sut.Map(model)!;
// Assert
matcher.GetPatterns().Should().HaveElementAt(0, testSchema);
matcher.Name.Should().Be(nameof(GraphQLMatcher));
matcher.CustomScalars.Should().BeEquivalentTo(customScalars);
}
#endif
}

View File

@@ -1,406 +0,0 @@
using System;
using System.Collections.Generic;
using AnyOfTypes;
using FluentAssertions;
using FluentAssertions.Execution;
using Moq;
using Newtonsoft.Json;
using NFluent;
using WireMock.Admin.Mappings;
using WireMock.Handlers;
using WireMock.Matchers;
using WireMock.Models;
using WireMock.Serialization;
using WireMock.Settings;
using Xunit;
namespace WireMock.Net.Tests.Serialization;
public class MatcherModelMapperTests
{
private readonly WireMockServerSettings _settings = new();
private readonly MatcherMapper _sut;
public MatcherModelMapperTests()
{
_sut = new MatcherMapper(_settings);
}
[Fact]
public void MatcherModelMapper_Map_CSharpCodeMatcher()
{
// Assign
var model = new MatcherModel
{
Name = "CSharpCodeMatcher",
Patterns = new[] { "return it == \"x\";" }
};
var sut = new MatcherMapper(new WireMockServerSettings { AllowCSharpCodeMatcher = true });
// Act 1
var matcher1 = (ICSharpCodeMatcher)sut.Map(model)!;
// Assert 1
matcher1.Should().NotBeNull();
matcher1.IsMatch("x").Score.Should().Be(1.0d);
// Act 2
var matcher2 = (ICSharpCodeMatcher)sut.Map(model)!;
// Assert 2
matcher2.Should().NotBeNull();
matcher2.IsMatch("x").Score.Should().Be(1.0d);
}
[Fact]
public void MatcherModelMapper_Map_CSharpCodeMatcher_NotAllowed_ThrowsException()
{
// Assign
var model = new MatcherModel
{
Name = "CSharpCodeMatcher",
Patterns = new[] { "x" }
};
var sut = new MatcherMapper(new WireMockServerSettings { AllowCSharpCodeMatcher = false });
// Act
Action action = () => sut.Map(model);
// Assert
action.Should().Throw<NotSupportedException>();
}
[Fact]
public void MatcherModelMapper_Map_Null()
{
// Act
IMatcher matcher = _sut.Map((MatcherModel?)null)!;
// Assert
Check.That(matcher).IsNull();
}
[Fact]
public void MatcherModelMapper_Map_ExactMatcher_Pattern()
{
// Assign
var model = new MatcherModel
{
Name = "ExactMatcher",
Patterns = new[] { "x" }
};
// Act
var matcher = (ExactMatcher)_sut.Map(model)!;
// Assert
matcher.GetPatterns().Should().ContainSingle("x");
}
[Fact]
public void MatcherModelMapper_Map_ExactMatcher_Patterns()
{
// Assign
var model = new MatcherModel
{
Name = "ExactMatcher",
Patterns = new[] { "x", "y" }
};
// Act
var matcher = (ExactMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
}
[Fact]
public void MatcherModelMapper_Map_JsonPartialMatcher_RegexFalse()
{
// Assign
var pattern = "{ \"x\": 1 }";
var model = new MatcherModel
{
Name = "JsonPartialMatcher",
Regex = false,
Pattern = pattern
};
// Act
var matcher = (JsonPartialMatcher)_sut.Map(model)!;
// Assert
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
matcher.IgnoreCase.Should().BeFalse();
matcher.Value.Should().Be(pattern);
matcher.Regex.Should().BeFalse();
}
[Fact]
public void MatcherModelMapper_Map_JsonPartialMatcher_RegexTrue()
{
// Assign
var pattern = "{ \"x\": 1 }";
var model = new MatcherModel
{
Name = "JsonPartialMatcher",
Regex = true,
Pattern = pattern
};
// Act
var matcher = (JsonPartialMatcher)_sut.Map(model)!;
// Assert
matcher.MatchBehaviour.Should().Be(MatchBehaviour.AcceptOnMatch);
matcher.IgnoreCase.Should().BeFalse();
matcher.Value.Should().Be(pattern);
matcher.Regex.Should().BeTrue();
}
[Fact]
public void MatcherModelMapper_Map_ExactObjectMatcher_ValidBase64StringPattern()
{
// Assign
var model = new MatcherModel
{
Name = "ExactObjectMatcher",
Patterns = new object[] { "c3RlZg==" }
};
// Act
var matcher = (ExactObjectMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.ValueAsBytes).ContainsExactly(new byte[] { 115, 116, 101, 102 });
}
[Fact]
public void MatcherModelMapper_Map_ExactObjectMatcher_InvalidBase64StringPattern()
{
// Assign
var model = new MatcherModel
{
Name = "ExactObjectMatcher",
Patterns = new object[] { "_" }
};
// Act & Assert
Check.ThatCode(() => _sut.Map(model)).Throws<ArgumentException>();
}
[Theory]
[InlineData(MatchOperator.Or, 1.0d)]
[InlineData(MatchOperator.And, 0.0d)]
[InlineData(MatchOperator.Average, 0.5d)]
public void MatcherModelMapper_Map_RegexMatcher(MatchOperator matchOperator, double expected)
{
// Assign
var model = new MatcherModel
{
Name = "RegexMatcher",
Patterns = new[] { "x", "y" },
IgnoreCase = true,
MatchOperator = matchOperator.ToString()
};
// Act
var matcher = (RegexMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
var result = matcher.IsMatch("X");
result.Score.Should().Be(expected);
}
[Theory]
[InlineData(MatchOperator.Or, 1.0d)]
[InlineData(MatchOperator.And, 0.0d)]
[InlineData(MatchOperator.Average, 0.5d)]
public void MatcherModelMapper_Map_WildcardMatcher_IgnoreCase(MatchOperator matchOperator, double expected)
{
// Assign
var model = new MatcherModel
{
Name = "WildcardMatcher",
Patterns = new[] { "x", "y" },
IgnoreCase = true,
MatchOperator = matchOperator.ToString()
};
// Act
var matcher = (WildcardMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
var result = matcher.IsMatch("X");
result.Score.Should().Be(expected);
}
[Fact]
public void MatcherModelMapper_Map_WildcardMatcher_With_PatternAsFile()
{
// Arrange
var file = "c:\\test.txt";
var fileContent = "c";
var stringPattern = new StringPattern
{
Pattern = fileContent,
PatternAsFile = file
};
var fileSystemHandleMock = new Mock<IFileSystemHandler>();
fileSystemHandleMock.Setup(f => f.ReadFileAsString(file)).Returns(fileContent);
var model = new MatcherModel
{
Name = "WildcardMatcher",
PatternAsFile = file
};
var settings = new WireMockServerSettings
{
FileSystemHandler = fileSystemHandleMock.Object
};
var sut = new MatcherMapper(settings);
// Act
var matcher = (WildcardMatcher)sut.Map(model)!;
// Assert
matcher.GetPatterns().Should().HaveCount(1).And.Contain(new AnyOf<string, StringPattern>(stringPattern));
var result = matcher.IsMatch("c");
result.Score.Should().Be(MatchScores.Perfect);
}
[Fact]
public void MatcherModelMapper_Map_SimMetricsMatcher()
{
// Assign
var model = new MatcherModel
{
Name = "SimMetricsMatcher",
Pattern = "x"
};
// Act
var matcher = (SimMetricsMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x");
}
[Fact]
public void MatcherModelMapper_Map_SimMetricsMatcher_BlockDistance()
{
// Assign
var model = new MatcherModel
{
Name = "SimMetricsMatcher.BlockDistance",
Pattern = "x"
};
// Act
var matcher = (SimMetricsMatcher)_sut.Map(model)!;
// Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x");
}
[Fact]
public void MatcherModelMapper_Map_SimMetricsMatcher_Throws1()
{
// Assign
var model = new MatcherModel
{
Name = "error",
Pattern = "x"
};
// Act
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
}
[Fact]
public void MatcherModelMapper_Map_SimMetricsMatcher_Throws2()
{
// Assign
var model = new MatcherModel
{
Name = "SimMetricsMatcher.error",
Pattern = "x"
};
// Act
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
}
[Fact]
public void MatcherModelMapper_Map_MatcherModelToCustomMatcher()
{
// Arrange
var patternModel = new CustomPathParamMatcherModel("/customer/{customerId}/document/{documentId}",
new Dictionary<string, string>(2)
{
{ "customerId", @"^[0-9]+$" },
{ "documentId", @"^[0-9a-zA-Z\-\_]+\.[a-zA-Z]+$" }
});
var model = new MatcherModel
{
Name = nameof(CustomPathParamMatcher),
Pattern = JsonConvert.SerializeObject(patternModel)
};
var settings = new WireMockServerSettings();
settings.CustomMatcherMappings = settings.CustomMatcherMappings ?? new Dictionary<string, Func<MatcherModel, IMatcher>>();
settings.CustomMatcherMappings[nameof(CustomPathParamMatcher)] = matcherModel =>
{
var matcherParams = JsonConvert.DeserializeObject<CustomPathParamMatcherModel>((string)matcherModel.Pattern!)!;
return new CustomPathParamMatcher(
matcherModel.RejectOnMatch == true ? MatchBehaviour.RejectOnMatch : MatchBehaviour.AcceptOnMatch,
matcherParams.Path,
matcherParams.PathParams
);
};
var sut = new MatcherMapper(settings);
// Act
var matcher = sut.Map(model) as CustomPathParamMatcher;
// Assert
matcher.Should().NotBeNull();
}
[Fact]
public void MatcherModelMapper_Map_CustomMatcherToMatcherModel()
{
// Arrange
var matcher = new CustomPathParamMatcher("/customer/{customerId}/document/{documentId}",
new Dictionary<string, string>(2)
{
{ "customerId", @"^[0-9]+$" },
{ "documentId", @"^[0-9a-zA-Z\-\_]+\.[a-zA-Z]+$" }
});
// Act
var model = _sut.Map(matcher)!;
// Assert
using (new AssertionScope())
{
model.Should().NotBeNull();
model.Name.Should().Be(nameof(CustomPathParamMatcher));
var matcherParams = JsonConvert.DeserializeObject<CustomPathParamMatcherModel>((string)model.Pattern!)!;
matcherParams.Path.Should().Be("/customer/{customerId}/document/{documentId}");
matcherParams.PathParams.Should().BeEquivalentTo(new Dictionary<string, string>(2)
{
{ "customerId", @"^[0-9]+$" },
{ "documentId", @"^[0-9a-zA-Z\-\_]+\.[a-zA-Z]+$" }
});
}
}
}

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net452;net461;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net452;net461;netcoreapp3.1;net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>11</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>

View File

@@ -0,0 +1,30 @@
{
Guid: 90356dba-b36c-469a-a17e-669cd84f1f05,
UpdatedAt: DateTime_1,
Request: {
Path: {
Matchers: [
{
Name: WildcardMatcher,
Pattern: /1,
IgnoreCase: false
}
]
},
Body: {
Matcher: {
Name: RegexMatcher,
Pattern: hello,
IgnoreCase: true
}
}
},
Response: {
ProxyUrl: https://my-proxy.com,
ProxyUrlReplaceSettings: {
OldValue: x,
NewValue: y,
IgnoreCase: true
}
}
}

View File

@@ -351,6 +351,57 @@ public class WireMockAdminApiTests
server.Stop();
}
[Fact]
public async Task IWireMockAdminApi_GetMappingAsync_WithProxy_And_ProxyUrlReplaceSettings()
{
// Arrange
var guid = Guid.Parse("90356dba-b36c-469a-a17e-669cd84f1f05");
var server = WireMockServer.StartWithAdminInterface();
var api = RestClient.For<IWireMockAdminApi>(server.Url);
// Act
var model = new MappingModel
{
Guid = guid,
Request = new RequestModel
{
Path = "/1",
Body = new BodyModel
{
Matcher = new MatcherModel
{
Name = "RegexMatcher",
Pattern = "hello",
IgnoreCase = true
}
}
},
Response = new ResponseModel
{
ProxyUrl = "https://my-proxy.com",
ProxyUrlReplaceSettings = new ProxyUrlReplaceSettingsModel
{
OldValue = "x",
NewValue = "y",
IgnoreCase = true
}
}
};
var postMappingResult = await api.PostMappingAsync(model).ConfigureAwait(false);
// Assert
postMappingResult.Should().NotBeNull();
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
mapping.Should().NotBeNull();
var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
server.Stop();
}
[Fact]
public async Task IWireMockAdminApi_GetRequestsAsync_Json()
{

View File

@@ -922,4 +922,49 @@ public class WireMockServerProxyTests
server.LogEntries.Should().HaveCount(1);
server.Stop();
}
[Fact]
public async Task WireMockServer_ProxyAndRecordSettings_SameRequest_ShouldProxyAll()
{
//Arrange
var wireMockServerSettings = new WireMockServerSettings
{
Urls = new[] { "http://localhost:9091" },
ProxyAndRecordSettings = new ProxyAndRecordSettings
{
Url = "http://postman-echo.com",
SaveMapping = true,
ProxyAll = true,
SaveMappingToFile = false,
ExcludedHeaders = new[] { "Postman-Token" },
ExcludedCookies = new[] { "sails.sid" }
}
};
var server = WireMockServer.Start(wireMockServerSettings);
var requestBody = "{\"key1\": \"value1\", \"key2\": \"value2\"}";
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost:9091/post"),
Content = new StringContent(requestBody)
};
var request2 = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("http://localhost:9091/post"),
Content = new StringContent(requestBody)
};
server.ResetMappings();
//Act
await new HttpClient().SendAsync(request);
await new HttpClient().SendAsync(request2);
//Assert
Check.That(server.Mappings.Count()).IsEqualTo(3);
server.Dispose();
}
}

View File

@@ -230,7 +230,7 @@ public partial class WireMockServerTests
server.Stop();
}
#if NETCOREAPP3_1 || NET5_0 || NET6_0 || NET7_0
#if NETCOREAPP3_1 || NET5_0_OR_GREATER
[Fact]
public async Task WireMockServer_WithCorsPolicyOptions_Should_Work_Correct()
{

View File

@@ -1,17 +1,15 @@
namespace MultipartUploader
namespace MultipartUploader;
internal static class Program
{
internal static class Program
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
// To customize application configuration such as set high DPI settings or default font, see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}