mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-09 19:03:52 +02:00
Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88ff2a72db | ||
|
|
d5026e83b5 | ||
|
|
b6b17d80cc | ||
|
|
c8ad9f49e4 | ||
|
|
0a4aca9ae9 | ||
|
|
e5ed6036ee | ||
|
|
7b534635b9 | ||
|
|
1562958172 | ||
|
|
35d42a5c0d | ||
|
|
429d6830ae | ||
|
|
38634ac65a | ||
|
|
ef5f988786 | ||
|
|
1e44f52ad6 | ||
|
|
7fd1d30d0e | ||
|
|
49b29d74dc | ||
|
|
80931e9fb5 | ||
|
|
cce344ff83 | ||
|
|
0972d2cb8f | ||
|
|
a39b7fc633 | ||
|
|
31298d281d | ||
|
|
b4c32dd66b | ||
|
|
57115f1a3d | ||
|
|
306c69f478 | ||
|
|
fb8fec0376 | ||
|
|
dd1a6fa508 | ||
|
|
36037627bc | ||
|
|
55afc8041f | ||
|
|
b523ab9125 | ||
|
|
14dd619763 | ||
|
|
430c01a461 | ||
|
|
f7b04f3234 | ||
|
|
c0b18631a3 | ||
|
|
fd996ab4ed | ||
|
|
a57626c63a | ||
|
|
98a0f2fa28 | ||
|
|
13a06b9b38 | ||
|
|
74480c8ba9 | ||
|
|
862c04e722 | ||
|
|
cd93422554 | ||
|
|
775c4fb2e3 | ||
|
|
2d4f513753 | ||
|
|
3d29d7fb2f | ||
|
|
f704de65d8 | ||
|
|
f0d6ed26bc | ||
|
|
330559b9fd | ||
|
|
e2bd56531d | ||
|
|
d2a1d0f069 | ||
|
|
b1af37f044 | ||
|
|
be4b0addca | ||
|
|
ae91ed2a79 | ||
|
|
968aa598e2 | ||
|
|
bdd421e128 | ||
|
|
150b448d07 | ||
|
|
717179fd35 | ||
|
|
9b7e5908cb | ||
|
|
b1032c9dcd | ||
|
|
4d0f96eabe | ||
|
|
ef12cb70cc | ||
|
|
c212d07c53 | ||
|
|
b9afb126cf |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: # [StefH]
|
github: [StefH]
|
||||||
patreon: # Replace with a single Patreon username
|
patreon: # Replace with a single Patreon username
|
||||||
open_collective: # wiremocknet
|
open_collective: # wiremocknet
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
|||||||
75
CHANGELOG.md
75
CHANGELOG.md
@@ -1,3 +1,78 @@
|
|||||||
|
# 1.5.11 (24 November 2022)
|
||||||
|
- [#836](https://github.com/WireMock-Net/WireMock.Net/pull/836) - Add Settings.QueryParameterMultipleValueSupport [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#848](https://github.com/WireMock-Net/WireMock.Net/pull/848) - Use try-catch when adding or removing logEntry [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#846](https://github.com/WireMock-Net/WireMock.Net/issues/846) - Exception ArgumentOutOfRangeException [bug]
|
||||||
|
|
||||||
|
# 1.5.10 (06 November 2022)
|
||||||
|
- [#843](https://github.com/WireMock-Net/WireMock.Net/pull/843) - Webhook Templating: Use the transformed URL to create the HttpRequestMessage contributed by [ggradnig](https://github.com/ggradnig)
|
||||||
|
- [#845](https://github.com/WireMock-Net/WireMock.Net/pull/845) - Add WireMockNullLogger as valid commandline logger option [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|
||||||
|
# 1.5.9 (29 October 2022)
|
||||||
|
- [#828](https://github.com/WireMock-Net/WireMock.Net/pull/828) - Add setting to skip saving the string-response in the logging when using WithBody(Func...) [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#832](https://github.com/WireMock-Net/WireMock.Net/pull/832) - Fixes for WireMock.Net.FluentAssertions (callcount behaviour) [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#834](https://github.com/WireMock-Net/WireMock.Net/pull/834) - Support deleting / resetting a single scenario [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#837](https://github.com/WireMock-Net/WireMock.Net/pull/837) - Bump Microsoft.AspNetCore.Server.Kestrel.Core from 2.1.7 to 2.1.25 in /examples/WireMock.Net.StandAlone.Net461 [dependencies] contributed by [dependabot[bot]](https://github.com/apps/dependabot)
|
||||||
|
- [#838](https://github.com/WireMock-Net/WireMock.Net/pull/838) - Add option to ProxySettings to append guid to mapping file contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#826](https://github.com/WireMock-Net/WireMock.Net/issues/826) - Dynamic Body not to be cached when a Func is used to created the body [feature]
|
||||||
|
|
||||||
|
# 1.5.8 (16 October 2022)
|
||||||
|
- [#816](https://github.com/WireMock-Net/WireMock.Net/pull/816) - Some fixes to WireMock.Net.Assertions [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#817](https://github.com/WireMock-Net/WireMock.Net/pull/817) - ExactMatcher : IgnoreCase [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#824](https://github.com/WireMock-Net/WireMock.Net/pull/824) - WebHook - Transform Url [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#814](https://github.com/WireMock-Net/WireMock.Net/issues/814) - WithHeader cannot handle multiple requests with the same header key values [bug]
|
||||||
|
- [#815](https://github.com/WireMock-Net/WireMock.Net/issues/815) - Why does UsingMethod check _callscount? [bug]
|
||||||
|
- [#822](https://github.com/WireMock-Net/WireMock.Net/issues/822) - Webhook with generic url, body and custom header values [feature]
|
||||||
|
|
||||||
|
# 1.5.7 (11 October 2022)
|
||||||
|
- [#818](https://github.com/WireMock-Net/WireMock.Net/pull/818) - Add option to run the server on http & https [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#821](https://github.com/WireMock-Net/WireMock.Net/pull/821) - Add UseDefinedRequestMatchers to ProxyAndRecordSettings [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#823](https://github.com/WireMock-Net/WireMock.Net/pull/823) - Add implicit operators to WireMockList contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#819](https://github.com/WireMock-Net/WireMock.Net/issues/819) - Can I preserve Mapping title and matchers for proxy response? [feature]
|
||||||
|
|
||||||
|
# 1.5.6 (12 September 2022)
|
||||||
|
- [#803](https://github.com/WireMock-Net/WireMock.Net/pull/803) - WebHook : UseFireAndForget + Delay [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#804](https://github.com/WireMock-Net/WireMock.Net/pull/804) - Change nuget to package reference for WireMock.Net.Console.Net472.Cla… [feature] contributed by [mattisking](https://github.com/mattisking)
|
||||||
|
- [#806](https://github.com/WireMock-Net/WireMock.Net/pull/806) - Tweak middleware and fix bug in example [feature] contributed by [mattisking](https://github.com/mattisking)
|
||||||
|
- [#801](https://github.com/WireMock-Net/WireMock.Net/issues/801) - Webhook Delays [feature]
|
||||||
|
|
||||||
|
# 1.5.5 (03 September 2022)
|
||||||
|
- [#798](https://github.com/WireMock-Net/WireMock.Net/pull/798) - Add support to use 'mapping' object in in reponse templating [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#800](https://github.com/WireMock-Net/WireMock.Net/pull/800) - Bump Microsoft.Owin from 4.1.1 to 4.2.2 in /src/WireMock.Net (net46) [dependencies] contributed by [dependabot[bot]](https://github.com/apps/dependabot)
|
||||||
|
- [#802](https://github.com/WireMock-Net/WireMock.Net/pull/802) - Add assertions for request methods contributed by [rafaelmfonseca](https://github.com/rafaelmfonseca)
|
||||||
|
- [#772](https://github.com/WireMock-Net/WireMock.Net/issues/772) - How to get matched mapping by HttpRequest or HttpRequestMessage [feature]
|
||||||
|
|
||||||
|
# 1.5.4 (24 August 2022)
|
||||||
|
- [#778](https://github.com/WireMock-Net/WireMock.Net/pull/778) - Fix Proxying when StartAdminInterface=true [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#781](https://github.com/WireMock-Net/WireMock.Net/pull/781) - Update some NuGet packages [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#783](https://github.com/WireMock-Net/WireMock.Net/pull/783) - Fix WithBody when using Pact and added more nullable annotations [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#787](https://github.com/WireMock-Net/WireMock.Net/pull/787) - Add support for PEM certificates contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#789](https://github.com/WireMock-Net/WireMock.Net/pull/789) - Add support for Matcher.Pattern in Pact Body mapping [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#790](https://github.com/WireMock-Net/WireMock.Net/pull/790) - Add Response.WithBody with IJsonConverter [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#795](https://github.com/WireMock-Net/WireMock.Net/pull/795) - Add check for duplicate Guids when posting multiple mappings in one request contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#797](https://github.com/WireMock-Net/WireMock.Net/pull/797) - Fix WithHeader when using RejectOnMatch [bug] contributed by [flts](https://github.com/flts)
|
||||||
|
- [#775](https://github.com/WireMock-Net/WireMock.Net/issues/775) - When "StartAdminInterface" is true then each time is generated new mapping from the proxy [bug]
|
||||||
|
- [#784](https://github.com/WireMock-Net/WireMock.Net/issues/784) - Response body is missing in generated pact file when IBodyResponseBuilder.WithBody is used [bug]
|
||||||
|
- [#785](https://github.com/WireMock-Net/WireMock.Net/issues/785) - Support for PEM certificates when using ssl [feature]
|
||||||
|
- [#788](https://github.com/WireMock-Net/WireMock.Net/issues/788) - Request body is missing in generated pact file for requests that include matching on request body [bug]
|
||||||
|
- [#796](https://github.com/WireMock-Net/WireMock.Net/issues/796) - RequestMessageHeaderMatcher with MatchBehaviour.RejectOnMatch reverses match results twice [bug]
|
||||||
|
|
||||||
|
# 1.5.3 (29 July 2022)
|
||||||
|
- [#777](https://github.com/WireMock-Net/WireMock.Net/pull/777) - Update Scriban.Signed to version 5.5.0 [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#776](https://github.com/WireMock-Net/WireMock.Net/issues/776) - Update Scriban.Signed to support more functions, e.g math.random [feature]
|
||||||
|
|
||||||
|
# 1.5.2 (24 July 2022)
|
||||||
|
- [#769](https://github.com/WireMock-Net/WireMock.Net/pull/769) - Bump Microsoft.AspNetCore.Server.Kestrel.Core from 2.1.3 to 2.1.7 in /examples/WireMock.Net.StandAlone.Net461 [dependencies] contributed by [dependabot[bot]](https://github.com/apps/dependabot)
|
||||||
|
- [#770](https://github.com/WireMock-Net/WireMock.Net/pull/770) - Added some more tests for JsonMatcher + refactored some code to use nullable [test] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#771](https://github.com/WireMock-Net/WireMock.Net/pull/771) - JsonPartialMatcher - support Regex [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|
||||||
|
# 1.5.1 (08 July 2022)
|
||||||
|
- [#762](https://github.com/WireMock-Net/WireMock.Net/pull/762) - Bump Newtonsoft.Json from 11.0.2 to 13.0.1 in /examples/WireMock.Net.WebApplication.NETCore2 [dependencies] contributed by [dependabot[bot]](https://github.com/apps/dependabot)
|
||||||
|
- [#763](https://github.com/WireMock-Net/WireMock.Net/pull/763) - Bump Newtonsoft.Json from 6.0.1 to 13.0.1 in /examples/WireMock.Net.Client.Net472 [dependencies] contributed by [dependabot[bot]](https://github.com/apps/dependabot)
|
||||||
|
- [#765](https://github.com/WireMock-Net/WireMock.Net/pull/765) - Update WireMock.Org.Abstractions and WireMock.Org.RestClient [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#766](https://github.com/WireMock-Net/WireMock.Net/pull/766) - Bump Microsoft.AspNetCore.Http from 2.1.1 to 2.1.22 in /examples/WireMock.Net.StandAlone.Net461 [dependencies] contributed by [dependabot[bot]](https://github.com/apps/dependabot)
|
||||||
|
- [#767](https://github.com/WireMock-Net/WireMock.Net/pull/767) - Rename (WireMock.Pact.Models.V2)-Request to PactRequest and -Response to PactResponse [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#764](https://github.com/WireMock-Net/WireMock.Net/issues/764) - Wrong mapping of method GetAdminMappingsAsync from IWireMockOrgApi [bug]
|
||||||
|
|
||||||
# 1.5.0 (09 June 2022)
|
# 1.5.0 (09 June 2022)
|
||||||
- [#755](https://github.com/WireMock-Net/WireMock.Net/pull/755) - Add MatchOperator "Or", "And" and "Average" for patterns [feature] contributed by [StefH](https://github.com/StefH)
|
- [#755](https://github.com/WireMock-Net/WireMock.Net/pull/755) - Add MatchOperator "Or", "And" and "Average" for patterns [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>1.5.0</VersionPrefix>
|
<VersionPrefix>1.5.11</VersionPrefix>
|
||||||
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
||||||
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/WireMock-Net/WireMock.Net</PackageProjectUrl>
|
||||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||||
@@ -20,15 +20,18 @@
|
|||||||
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- https://github.com/coverlet-coverage/coverlet/issues/1391 -->
|
||||||
|
<PropertyGroup Condition="$(MSBuildProjectName.Contains('.Tests'))">
|
||||||
|
<CollectCoverage>true</CollectCoverage>
|
||||||
|
<ExcludeByAttribute>GeneratedCodeAttribute</ExcludeByAttribute>
|
||||||
|
<CoverletOutputFormat>opencover</CoverletOutputFormat>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="../../resources/WireMock.Net-Logo.png" Pack="true" PackagePath="" />
|
<None Include="../../resources/WireMock.Net-Logo.png" Pack="true" PackagePath="" />
|
||||||
<!--<None Include="../../PackageReadme.md" Pack="true" PackagePath=""/>-->
|
<!--<None Include="../../PackageReadme.md" Pack="true" PackagePath=""/>-->
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(TargetFramework)' != 'net45'">
|
|
||||||
<!--<Nullable>enable</Nullable>-->
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<Choose>
|
<Choose>
|
||||||
<!-- The environment variable `Prerelease` is set in the azure-pipelines.yml file. -->
|
<!-- The environment variable `Prerelease` is set in the azure-pipelines.yml file. -->
|
||||||
<When Condition=" '$(Prerelease)' != '' ">
|
<When Condition=" '$(Prerelease)' != '' ">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
rem https://github.com/StefH/GitHubReleaseNotes
|
rem https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
SET version=1.5.0
|
SET version=1.5.11
|
||||||
|
|
||||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version% --token %GH_TOKEN%
|
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels question invalid doc duplicate --version %version% --token %GH_TOKEN%
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# 1.5.0 (09 June 2022)
|
# 1.5.11 (24 November 2022)
|
||||||
- #755 Add MatchOperator "Or", "And" and "Average" for patterns [feature]
|
- #836 Add Settings.QueryParameterMultipleValueSupport [feature]
|
||||||
|
- #848 Use try-catch when adding or removing logEntry [bug]
|
||||||
|
- #846 Exception ArgumentOutOfRangeException [bug]
|
||||||
|
|
||||||
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
The full release notes can be found here: https://github.com/WireMock-Net/WireMock.Net/blob/master/CHANGELOG.md
|
||||||
@@ -25,6 +25,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
CHANGELOG.md = CHANGELOG.md
|
CHANGELOG.md = CHANGELOG.md
|
||||||
Directory.Build.props = Directory.Build.props
|
Directory.Build.props = Directory.Build.props
|
||||||
|
.github\FUNDING.yml = .github\FUNDING.yml
|
||||||
Generate-ReleaseNotes.cmd = Generate-ReleaseNotes.cmd
|
Generate-ReleaseNotes.cmd = Generate-ReleaseNotes.cmd
|
||||||
nuget.config = nuget.config
|
nuget.config = nuget.config
|
||||||
PackageReleaseNotes.template = PackageReleaseNotes.template
|
PackageReleaseNotes.template = PackageReleaseNotes.template
|
||||||
@@ -103,6 +104,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.Proxy.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.xUnit", "src\WireMock.Net.xUnit\WireMock.Net.xUnit.csproj", "{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.xUnit", "src\WireMock.Net.xUnit\WireMock.Net.xUnit.csproj", "{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMock.Net.Console.NET6.WithCertificate", "examples\WireMock.Net.Console.NET6.WithCertificate\WireMock.Net.Console.NET6.WithCertificate.csproj", "{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueExample", "examples\WireMockAzureQueueExample\WireMockAzureQueueExample.csproj", "{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WireMockAzureQueueProxy", "examples\WireMockAzureQueueProxy\WireMockAzureQueueProxy.csproj", "{ADB557D8-D66B-4387-912B-3F73E290B478}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -245,6 +252,18 @@ Global
|
|||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{ADB557D8-D66B-4387-912B-3F73E290B478}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{ADB557D8-D66B-4387-912B-3F73E290B478}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{ADB557D8-D66B-4387-912B-3F73E290B478}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{ADB557D8-D66B-4387-912B-3F73E290B478}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -286,6 +305,9 @@ Global
|
|||||||
{3F7AA023-6833-4856-A08A-4B5717B592B8} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
{3F7AA023-6833-4856-A08A-4B5717B592B8} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
{670C7562-C154-442E-A249-7D26849BCD13} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
{670C7562-C154-442E-A249-7D26849BCD13} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
{0DE0954F-8C00-4E8D-B94A-4361FC1CBE44} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
|
||||||
|
{7C2A9DE8-C89F-4841-9058-6B9BF81E5E34} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
|
{BAA9EC2A-874B-45CE-8E51-A73622DC7F3D} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
|
{ADB557D8-D66B-4387-912B-3F73E290B478} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458}
|
SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458}
|
||||||
|
|||||||
@@ -1,18 +1,30 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AD/@EntryIndexedValue">AD</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=AD/@EntryIndexedValue">AD</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CONNECT/@EntryIndexedValue">CONNECT</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CS/@EntryIndexedValue">CS</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CS/@EntryIndexedValue">CS</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DELETE/@EntryIndexedValue">DELETE</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EC/@EntryIndexedValue">EC</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GET/@EntryIndexedValue">GET</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HEAD/@EntryIndexedValue">HEAD</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD5</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD5</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OPTIONS/@EntryIndexedValue">OPTIONS</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PATCH/@EntryIndexedValue">PATCH</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=POST/@EntryIndexedValue">POST</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PUT/@EntryIndexedValue">PUT</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RSA/@EntryIndexedValue">RSA</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SSL/@EntryIndexedValue">SSL</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SSL/@EntryIndexedValue">SSL</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TE/@EntryIndexedValue">TE</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TE/@EntryIndexedValue">TE</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TSV/@EntryIndexedValue">TSV</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TSV/@EntryIndexedValue">TSV</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=TTL/@EntryIndexedValue">TTL</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WWW/@EntryIndexedValue">WWW</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WWW/@EntryIndexedValue">WWW</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XMS/@EntryIndexedValue">XMS</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XMS/@EntryIndexedValue">XMS</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XUA/@EntryIndexedValue">XUA</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=XUA/@EntryIndexedValue">XUA</s:String>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Flurl/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Flurl/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=funcs/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=funcs/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=guidb/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=guidb/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Guids/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Heyenrath/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Heyenrath/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Jmes/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Jmes/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pacticipant/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pacticipant/@EntryIndexedValue">True</s:Boolean>
|
||||||
@@ -24,6 +36,8 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Victoor/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Victoor/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Webhook/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Webhook/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Webhooks/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Webhooks/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=wiremock/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=wiremockserver/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=wiremockserver/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xeger/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=xunit/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=xunit/@EntryIndexedValue">True</s:Boolean>
|
||||||
</wpf:ResourceDictionary>
|
</wpf:ResourceDictionary>
|
||||||
@@ -44,12 +44,10 @@ jobs:
|
|||||||
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
|
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
|
||||||
arguments: '--configuration Debug --framework net6.0'
|
arguments: '--configuration Debug --framework net6.0'
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
- task: CmdLine@2
|
||||||
displayName: 'Execute Unit tests'
|
|
||||||
inputs:
|
inputs:
|
||||||
command: 'test'
|
script: 'dotnet test ./test/WireMock.Net.Tests/WireMock.Net.Tests.csproj --no-build --configuration Debug --framework net6.0'
|
||||||
projects: './test/WireMock.Net.Tests/WireMock.Net.Tests.csproj'
|
displayName: 'Execute Unit Tests with Coverage'
|
||||||
arguments: '--no-build --configuration Debug --framework net6.0 --collect:"XPlat Code Coverage" --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
|
|
||||||
|
|
||||||
- task: SonarCloudAnalyze@1
|
- task: SonarCloudAnalyze@1
|
||||||
displayName: 'SonarCloud: Run Code Analysis'
|
displayName: 'SonarCloud: Run Code Analysis'
|
||||||
@@ -76,7 +74,7 @@ jobs:
|
|||||||
- task: PublishBuildArtifacts@1
|
- task: PublishBuildArtifacts@1
|
||||||
displayName: Publish coverage file
|
displayName: Publish coverage file
|
||||||
inputs:
|
inputs:
|
||||||
PathtoPublish: '/home/vsts/work/1/s/test/WireMock.Net.Tests/coverage.net6.0.opencover.xml'
|
PathtoPublish: './test/WireMock.Net.Tests/coverage.net6.0.opencover.xml'
|
||||||
|
|
||||||
- job: Windows_Build_Test
|
- job: Windows_Build_Test
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Brutal.Dev.StrongNameSigner" version="2.7.1" targetFramework="net472" />
|
<package id="Brutal.Dev.StrongNameSigner" version="2.7.1" targetFramework="net472" />
|
||||||
<package id="Newtonsoft.Json" version="6.0.1" targetFramework="net472" />
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
||||||
<package id="RestEase" version="1.4.10" targetFramework="net472" />
|
<package id="RestEase" version="1.4.10" targetFramework="net472" />
|
||||||
<package id="WireMock.Net.Abstractions" version="1.2.0" targetFramework="net472" />
|
<package id="WireMock.Net.Abstractions" version="1.2.0" targetFramework="net472" />
|
||||||
<package id="WireMock.Net.RestClient" version="1.2.0" targetFramework="net472" />
|
<package id="WireMock.Net.RestClient" version="1.2.0" targetFramework="net472" />
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"WSL": {
|
||||||
|
"commandName": "WSL2",
|
||||||
|
"distributionName": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
<PackageReference Include="RestEase" Version="1.5.6" />
|
<PackageReference Include="RestEase" Version="1.5.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
16
examples/WireMock.Net.Console.NET6.WithCertificate/HowTo.txt
Normal file
16
examples/WireMock.Net.Console.NET6.WithCertificate/HowTo.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
https://www.scottbrady91.com/openssl/creating-elliptical-curve-keys-using-openssl
|
||||||
|
|
||||||
|
# find your curve
|
||||||
|
openssl ecparam -list_curves
|
||||||
|
|
||||||
|
# generate a private key for a curve
|
||||||
|
openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
|
||||||
|
|
||||||
|
# generate corresponding public key
|
||||||
|
openssl ec -in private-key.pem -pubout -out public-key.pem
|
||||||
|
|
||||||
|
# optional: create a self-signed certificate
|
||||||
|
openssl req -new -x509 -key private-key.pem -out cert.pem -days 360
|
||||||
|
|
||||||
|
# optional: convert pem to pfx
|
||||||
|
openssl pkcs12 -export -inkey private-key.pem -in cert.pem -out cert.pfx
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using System.IO;
|
||||||
|
using WireMock.Logging;
|
||||||
|
using WireMock.Server;
|
||||||
|
using WireMock.Settings;
|
||||||
|
|
||||||
|
namespace WireMock.Net.Console.NET6.WithCertificate;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var serverEC = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
{
|
||||||
|
Urls = new[] { "https://localhost:8433/" },
|
||||||
|
StartAdminInterface = true,
|
||||||
|
Logger = new WireMockConsoleLogger(),
|
||||||
|
CertificateSettings = new WireMockCertificateSettings
|
||||||
|
{
|
||||||
|
// https://www.scottbrady91.com/c-sharp/pem-loading-in-dotnet-core-and-dotnet
|
||||||
|
// https://www.scottbrady91.com/openssl/creating-elliptical-curve-keys-using-openssl
|
||||||
|
X509CertificateFilePath = "cert.pem",
|
||||||
|
X509CertificatePassword = @"
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIJZTv6ujGrEwxW+ab1+CtZouRd8PK7PsklVMvJwm1uDmoAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAE39VoI268uDuIeKmRzr9e9jgMSGeuJTvTG7+cSXmeDymrVgIGXQgm
|
||||||
|
qKA8TDXpJNrRhWMd/fpsnWu1JwJUjBmspQ==
|
||||||
|
-----END EC PRIVATE KEY-----"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
System.Console.WriteLine("WireMockServer listening at {0}", serverEC.Url);
|
||||||
|
|
||||||
|
var serverRSA = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
{
|
||||||
|
Urls = new[] { "https://localhost:8434/" },
|
||||||
|
StartAdminInterface = true,
|
||||||
|
Logger = new WireMockConsoleLogger(),
|
||||||
|
CertificateSettings = new WireMockCertificateSettings
|
||||||
|
{
|
||||||
|
// https://www.scottbrady91.com/c-sharp/pem-loading-in-dotnet-core-and-dotnet
|
||||||
|
// https://www.scottbrady91.com/openssl/creating-rsa-keys-using-openssl
|
||||||
|
X509CertificateFilePath = "cert-rsa.pem",
|
||||||
|
X509CertificatePassword = File.ReadAllText("private-key-rsa.pem")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
System.Console.WriteLine("WireMockServer listening at {0}", serverRSA.Url);
|
||||||
|
|
||||||
|
System.Console.WriteLine("Press any key to stop the server(s)");
|
||||||
|
System.Console.ReadKey();
|
||||||
|
serverEC.Stop();
|
||||||
|
serverRSA.Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="*.pem">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="*.pfx">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="nlog.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIErzCCAxegAwIBAgIUeVJ5l3LJPakcwhBGXNfa7UawgPcwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwZzELMAkGA1UEBhMCTkwxEzARBgNVBAgMClNvbWUtU3RhdGUxFTATBgNVBAoM
|
||||||
|
DFdpcmVNb2NrLk5ldDEVMBMGA1UECwwMV2lyZU1vY2suTmV0MRUwEwYDVQQDDAxX
|
||||||
|
aXJlTW9jay5OZXQwHhcNMjIwODEyMTQzMjUxWhcNMzIwNjIwMTQzMjUxWjBnMQsw
|
||||||
|
CQYDVQQGEwJOTDETMBEGA1UECAwKU29tZS1TdGF0ZTEVMBMGA1UECgwMV2lyZU1v
|
||||||
|
Y2suTmV0MRUwEwYDVQQLDAxXaXJlTW9jay5OZXQxFTATBgNVBAMMDFdpcmVNb2Nr
|
||||||
|
Lk5ldDCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALyF2sKsueDaZ78r
|
||||||
|
fQ5IyqWJLYXnYRT94xVfiPoRQNex7JMYwdIt+xEPcfhIlyODxYRxzYTSuXi/cBOM
|
||||||
|
/svTewIdBmDDyyCDboZ+P8THlzdwCLNHUPONQqJtc0msLVfwPuvDeZIwhIn9CDwC
|
||||||
|
1EXstWLEePxu1i2/PAfUudYeQunjrP10DE06fyW+ZH7sMSPOSyY4BO4Rt0dk3Cws
|
||||||
|
U/CEl+bSN5Kx2WkyPxbOvZLa66JmQEaeSZ4ypkhujWE1LuIIQE94P28BzFpHtDWO
|
||||||
|
1+42K8mqjdnO8eH1/IfAMmOE/o3rKoI4C5aUPyJpDOaz5KFCqdCSBHlb2uo3lqgd
|
||||||
|
yYOCrVOLIsljp8H4ncfs1AUo+tExNW/5jWYegAZGXLArrWktHEbwa4f+9ZMa7+VS
|
||||||
|
lKpx6hLI7eMSHBCsQJ7yH8QyLhr0HMjoDw38isGV+mK/N1u47s4oaTQyG+HXH+e/
|
||||||
|
Shj5OSKnLWBV/eX7YSAJ1hqHgmAbwl/BnuGI3SBXSK4mcjcNvQIDAQABo1MwUTAd
|
||||||
|
BgNVHQ4EFgQUYhrgWXNdcFpnyz0mifPqYM+kyK4wHwYDVR0jBBgwFoAUYhrgWXNd
|
||||||
|
cFpnyz0mifPqYM+kyK4wDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
|
||||||
|
AYEAmfJZJ019pO7ZXDQ85nEC99+x9+MUnSZ6UuMIiy2VMcS/oea8ugQ4NBYVPpQS
|
||||||
|
O/xiYENpw36+H4+ctv1tdAbZELGGLBahkkzZedLyiFObxDALu0PP7jQYr4nUjfQj
|
||||||
|
B/fWuTcCrVmuH3yiutw/sALd1su63VjjZiOCwxMB8LV4T0ojBTHA2D4rqLTiSRgs
|
||||||
|
sP3CRoWDI2JIr2afM/K8SMczRbo/5ovv0YF9kFcwG9WDEa/oQ67Yu05GFBnItYmT
|
||||||
|
QP+Br5WiPTLOON9TKm1ZgxLwrhJNHfD2+u9uudkVF5uWyg9ZvB8sYmIw5wSvUFl5
|
||||||
|
SDj1Pxy4olim54BL5wIwlMMQu+fKp6T89iShgN/NEot3JKW3zDpa/t93IjJXGOlh
|
||||||
|
O4ECoUzXCtDTnc6aais2SoYjbveP2wduS9MHAQinjTiepzYbhJbySURKqCBu1mN2
|
||||||
|
EFsU9Pzd1+MA3ZbRfhvl8Jvwdp5GqaFyCqgqmP5oPOcd9ncJowyfobfdqzYMXPGl
|
||||||
|
bu9i
|
||||||
|
-----END CERTIFICATE-----
|
||||||
13
examples/WireMock.Net.Console.NET6.WithCertificate/cert.pem
Normal file
13
examples/WireMock.Net.Console.NET6.WithCertificate/cert.pem
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIB9TCCAZugAwIBAgIUYH7UM/DAXzosxsT+ea2jdYvhqqMwCgYIKoZIzj0EAwIw
|
||||||
|
UDELMAkGA1UEBhMCTkwxEzARBgNVBAgMClNvbWUtU3RhdGUxFTATBgNVBAoMDFdp
|
||||||
|
cmVNb2NrLk5ldDEVMBMGA1UEAwwMV2lyZU1vY2suTmV0MB4XDTIyMDgxMTE2MjE0
|
||||||
|
NFoXDTMyMDYxOTE2MjE0NFowUDELMAkGA1UEBhMCTkwxEzARBgNVBAgMClNvbWUt
|
||||||
|
U3RhdGUxFTATBgNVBAoMDFdpcmVNb2NrLk5ldDEVMBMGA1UEAwwMV2lyZU1vY2su
|
||||||
|
TmV0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE39VoI268uDuIeKmRzr9e9jgM
|
||||||
|
SGeuJTvTG7+cSXmeDymrVgIGXQgmqKA8TDXpJNrRhWMd/fpsnWu1JwJUjBmspaNT
|
||||||
|
MFEwHQYDVR0OBBYEFILL8V+fAtMnccWKGAdkx2Dh/v/TMB8GA1UdIwQYMBaAFILL
|
||||||
|
8V+fAtMnccWKGAdkx2Dh/v/TMA8GA1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwID
|
||||||
|
SAAwRQIgKDLAG8OWK6GF5HV4kmWz3kp2V3yVsNK2V9Lw3dSE+YsCIQCK1EEBvuqc
|
||||||
|
0ncZV4ETVnOY23PWFOMk1VwN2aoTi5n++Q==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIG5AIBAAKCAYEAvIXawqy54Npnvyt9DkjKpYkthedhFP3jFV+I+hFA17HskxjB
|
||||||
|
0i37EQ9x+EiXI4PFhHHNhNK5eL9wE4z+y9N7Ah0GYMPLIINuhn4/xMeXN3AIs0dQ
|
||||||
|
841Com1zSawtV/A+68N5kjCEif0IPALURey1YsR4/G7WLb88B9S51h5C6eOs/XQM
|
||||||
|
TTp/Jb5kfuwxI85LJjgE7hG3R2TcLCxT8ISX5tI3krHZaTI/Fs69ktrromZARp5J
|
||||||
|
njKmSG6NYTUu4ghAT3g/bwHMWke0NY7X7jYryaqN2c7x4fX8h8AyY4T+jesqgjgL
|
||||||
|
lpQ/ImkM5rPkoUKp0JIEeVva6jeWqB3Jg4KtU4siyWOnwfidx+zUBSj60TE1b/mN
|
||||||
|
Zh6ABkZcsCutaS0cRvBrh/71kxrv5VKUqnHqEsjt4xIcEKxAnvIfxDIuGvQcyOgP
|
||||||
|
DfyKwZX6Yr83W7juzihpNDIb4dcf579KGPk5IqctYFX95fthIAnWGoeCYBvCX8Ge
|
||||||
|
4YjdIFdIriZyNw29AgMBAAECggGBAJcMsNDWUECG/iVAFP0C+ctUdDMbxr9pBS+0
|
||||||
|
0i168XdhSeo6JeHfkZCDzY9fqil8hR+vhznrFUxYJtajW+u4UJDK7LdPaUttw3rj
|
||||||
|
YPir6s8yZuYuOABMqJ04EO1wlQwmpGOGxbuKQEfHg3eB1M8J7/No9H9d1yHkXZbw
|
||||||
|
rM2QhZCdKZgSCWE/g2ycdizz1hOYUMIYlGqjqzP67iY+hirqMkNxH7Hb6hTNe5ss
|
||||||
|
ntwxqCcAwnNSlC2661yRp5nBYQUeEfgXAx/cZZ6cILjX6JanDsML/PRY1hOm5hCZ
|
||||||
|
8/8satOGtd37rgr1cP/kvNMf7uLI8hIeC4JSCymUh6lU6ERpWRoQV8DUE60ztFbi
|
||||||
|
bQbGU/rseznBN8O1cM6fjduno/n8d4q5wGLjAbIai+xxxTSksbnlvkthRAUfK9/Y
|
||||||
|
rUdMxqgkDnecCAHof8UPz/Vg3n9J9wl6waFrKa+Kseda1wEB/jf51fb/t0sJP2Dq
|
||||||
|
n2kcp239zwalUr2XnXfENfeL9IDBiQKBwQDsogaTFy7E5P+66B1ZRDP2X6WgFedH
|
||||||
|
tjMCVXG4K4VOWp6xMfhieq2d+amMoYi/J3cxS8qDIM64q55caTaB3KTodGrzmvax
|
||||||
|
avqG58Mpyv9VdEDzMI29D7Xtx5ykoAAWOmQaByH/4J+3IBX6efRDGmSvmoqPoa0V
|
||||||
|
ChMO0Gw6O9GsH/kVEy2nRaj9dJpOqo05jhh9LLye2stPycCHzYybYqjs0Nt1uboY
|
||||||
|
3mbiCJBWJ8jZk9KeFhrqCkYB1zZJIJVybJ8CgcEAy/PRm0NZDUx6IJKnwDXBriE0
|
||||||
|
Qih1ZcvdVi907nhYAlBpAPWisGls6EghBQsfvQ4ZPwHAFBlDu/72JrqGJhkP61mP
|
||||||
|
D/xT9d59xSU5N90doiInrTHAOoyZEdpul9QvCXxKuFFl3RZnxn0RwPgc23sZUcny
|
||||||
|
aM4DIWk1541Z84Lxv3tFLXoG5uvqpCkSwEBd9iu0EMHlmoPFkEkY41Q3/zTs46FY
|
||||||
|
fnWLSdRahKDFHrZTgyu4i/3clbbp9m1cpWLwzUwjAoHAVpSWCT2jPCF5vD5vdpjw
|
||||||
|
1kV6yU8aV2+/zCvNNxCdbuTTSYw6EHZIjhOqSK1V5nMfNmc/yqi3WnRYtgE9E1jS
|
||||||
|
8cae11Es0A+PaMrl6qW+tNqbZR+vzKwx6bVuiAGO5pMoyyku9HuQlKVlxUbX67F9
|
||||||
|
g47tAc6rEJamEHaMEuaOOgdc0Kw6uQhQ46PFTeEzWQq3xR0YSptNZn0wN8AqoTQB
|
||||||
|
ENz+X128TJsbU7rEbPGTmKBwoKz/3gAySzwePbVxWPOLAoHAAsqehtKAKIdwcHux
|
||||||
|
YhcaRIjdzz4AhVkp+WEC57Sr97QkC8hQ5rs6q185XHlPgOXtgIhEmcHSxILz2Yna
|
||||||
|
BjF3n1AFfkGE4Kuf6w/cXaBgJHT1OBCjQenkunLT6q4TyrxxxV4P19vTpcrWcF60
|
||||||
|
/mgL66uo7rhLIKzw+O9dWNDlACruwnWWHJkECCUrxYfcAV+NwmD1BI1jKdtmRM5F
|
||||||
|
Se/ughsWO/zd4C/Q4VnV+Nqj//qcNwZNe5saTq4mg3j8NMMjAoHBANRR+WLpgr3f
|
||||||
|
Kh9vNA+v1gnBUFImheWrJ+Eu75q1sGKrz3gZ8glhewf37YbJVuSKFMEBAg1qobWG
|
||||||
|
/2B26beXia/NprVuV5vqJNuts29W1/WuDKE7BsNya/quDA1WxTQAzhSA54DYtWXw
|
||||||
|
UgVTPtEQXL9Wbk2wF98tWiUio4VjV++geVql4qKQUet1IMo1RgRgbQL5hn/rDH0g
|
||||||
|
ZOX552VdK1xivWQRVA4486eKHlW/lbKJjX0Os6qhNIF57qVquIRQPw==
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIJZTv6ujGrEwxW+ab1+CtZouRd8PK7PsklVMvJwm1uDmoAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAE39VoI268uDuIeKmRzr9e9jgMSGeuJTvTG7+cSXmeDymrVgIGXQgm
|
||||||
|
qKA8TDXpJNrRhWMd/fpsnWu1JwJUjBmspQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvIXawqy54Npnvyt9DkjK
|
||||||
|
pYkthedhFP3jFV+I+hFA17HskxjB0i37EQ9x+EiXI4PFhHHNhNK5eL9wE4z+y9N7
|
||||||
|
Ah0GYMPLIINuhn4/xMeXN3AIs0dQ841Com1zSawtV/A+68N5kjCEif0IPALURey1
|
||||||
|
YsR4/G7WLb88B9S51h5C6eOs/XQMTTp/Jb5kfuwxI85LJjgE7hG3R2TcLCxT8ISX
|
||||||
|
5tI3krHZaTI/Fs69ktrromZARp5JnjKmSG6NYTUu4ghAT3g/bwHMWke0NY7X7jYr
|
||||||
|
yaqN2c7x4fX8h8AyY4T+jesqgjgLlpQ/ImkM5rPkoUKp0JIEeVva6jeWqB3Jg4Kt
|
||||||
|
U4siyWOnwfidx+zUBSj60TE1b/mNZh6ABkZcsCutaS0cRvBrh/71kxrv5VKUqnHq
|
||||||
|
Esjt4xIcEKxAnvIfxDIuGvQcyOgPDfyKwZX6Yr83W7juzihpNDIb4dcf579KGPk5
|
||||||
|
IqctYFX95fthIAnWGoeCYBvCX8Ge4YjdIFdIriZyNw29AgMBAAE=
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-----BEGIN PUBLIC KEY-----
|
||||||
|
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE39VoI268uDuIeKmRzr9e9jgMSGeu
|
||||||
|
JTvTG7+cSXmeDymrVgIGXQgmqKA8TDXpJNrRhWMd/fpsnWu1JwJUjBmspQ==
|
||||||
|
-----END PUBLIC KEY-----
|
||||||
@@ -1,22 +1,21 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
using log4net.Repository;
|
using log4net.Repository;
|
||||||
using WireMock.Net.ConsoleApplication;
|
using WireMock.Net.ConsoleApplication;
|
||||||
|
|
||||||
namespace WireMock.Net.Console.NETCoreApp
|
namespace WireMock.Net.Console.NETCoreApp;
|
||||||
|
|
||||||
|
static class Program
|
||||||
{
|
{
|
||||||
static class Program
|
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
|
||||||
|
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
|
||||||
|
|
||||||
|
static void Main(params string[] args)
|
||||||
{
|
{
|
||||||
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
|
XmlConfigurator.Configure(LogRepository, new FileInfo("log4net.config"));
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
|
|
||||||
|
|
||||||
static void Main(params string[] args)
|
MainApp.Run();
|
||||||
{
|
|
||||||
XmlConfigurator.Configure(LogRepository, new FileInfo("log4net.config"));
|
|
||||||
|
|
||||||
MainApp.Run();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
using WireMock.Matchers;
|
using WireMock.Matchers;
|
||||||
|
using WireMock.Models;
|
||||||
using WireMock.RequestBuilders;
|
using WireMock.RequestBuilders;
|
||||||
using WireMock.ResponseBuilders;
|
using WireMock.ResponseBuilders;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
@@ -39,6 +40,19 @@ namespace WireMock.Net.ConsoleApplication
|
|||||||
var s = WireMockServer.Start();
|
var s = WireMockServer.Start();
|
||||||
s.Stop();
|
s.Stop();
|
||||||
|
|
||||||
|
var httpAndHttpsWithPort = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
{
|
||||||
|
HostingScheme = HostingScheme.HttpAndHttps,
|
||||||
|
Port = 12399
|
||||||
|
});
|
||||||
|
httpAndHttpsWithPort.Stop();
|
||||||
|
|
||||||
|
var httpAndHttpsFree = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
{
|
||||||
|
HostingScheme = HostingScheme.HttpAndHttps
|
||||||
|
});
|
||||||
|
httpAndHttpsFree.Stop();
|
||||||
|
|
||||||
string url1 = "http://localhost:9091/";
|
string url1 = "http://localhost:9091/";
|
||||||
string url2 = "http://localhost:9092/";
|
string url2 = "http://localhost:9092/";
|
||||||
string url3 = "https://localhost:9443/";
|
string url3 = "https://localhost:9443/";
|
||||||
@@ -576,6 +590,40 @@ namespace WireMock.Net.ConsoleApplication
|
|||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
server.Given(Request.Create().WithPath(new WildcardMatcher("/multi-webhook", true)).UsingPost())
|
||||||
|
.WithWebhook(new[] {
|
||||||
|
new Webhook()
|
||||||
|
{
|
||||||
|
Request = new WebhookRequest
|
||||||
|
{
|
||||||
|
Url = "http://localhost:12345/foo1",
|
||||||
|
Method = "post",
|
||||||
|
BodyData = new BodyData
|
||||||
|
{
|
||||||
|
BodyAsString = "OK 1!", DetectedBodyType = BodyType.String
|
||||||
|
},
|
||||||
|
Delay = 1000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Webhook()
|
||||||
|
{
|
||||||
|
Request = new WebhookRequest
|
||||||
|
{
|
||||||
|
Url = "http://localhost:12345/foo2",
|
||||||
|
Method = "post",
|
||||||
|
BodyData = new BodyData
|
||||||
|
{
|
||||||
|
BodyAsString = "OK 2!",
|
||||||
|
DetectedBodyType = BodyType.String
|
||||||
|
},
|
||||||
|
MinimumRandomDelay = 3000,
|
||||||
|
MaximumRandomDelay = 7000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.WithWebhookFireAndForget(true)
|
||||||
|
.RespondWith(Response.Create().WithBody("a-response"));
|
||||||
|
|
||||||
System.Console.WriteLine(JsonConvert.SerializeObject(server.MappingModels, Formatting.Indented));
|
System.Console.WriteLine(JsonConvert.SerializeObject(server.MappingModels, Formatting.Indented));
|
||||||
|
|
||||||
System.Console.WriteLine("Press any key to stop the server");
|
System.Console.WriteLine("Press any key to stop the server");
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
|
|
||||||
namespace WireMock.Net.ConsoleApplication
|
namespace WireMock.Net.ConsoleApplication;
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
static void Main(params string[] args)
|
|
||||||
{
|
|
||||||
XmlConfigurator.Configure(new FileInfo("log4net.config"));
|
|
||||||
|
|
||||||
MainApp.Run();
|
static class Program
|
||||||
}
|
{
|
||||||
|
static void Main(params string[] args)
|
||||||
|
{
|
||||||
|
XmlConfigurator.Configure(new FileInfo("log4net.config"));
|
||||||
|
|
||||||
|
MainApp.Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,6 @@
|
|||||||
<None Include="App.config">
|
<None Include="App.config">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</None>
|
</None>
|
||||||
<None Include="libman.json" />
|
|
||||||
<None Include="log4net.config">
|
<None Include="log4net.config">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that <see langword="null"/> is allowed as an input even if the
|
||||||
|
/// corresponding type disallows it.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property,
|
||||||
|
Inherited = false
|
||||||
|
)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class AllowNullAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="AllowNullAttribute"/> class.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public AllowNullAttribute() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that <see langword="null"/> is disallowed as an input even if the
|
||||||
|
/// corresponding type allows it.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property,
|
||||||
|
Inherited = false
|
||||||
|
)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class DisallowNullAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DisallowNullAttribute"/> class.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public DisallowNullAttribute() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that a method that will never return under any circumstance.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class DoesNotReturnAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DoesNotReturnAttribute"/> class.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
#endif
|
||||||
|
public DoesNotReturnAttribute() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that the method will not return if the associated <see cref="Boolean"/>
|
||||||
|
/// parameter is passed the specified value.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class DoesNotReturnIfAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the condition parameter value.
|
||||||
|
/// Code after the method is considered unreachable by diagnostics if the argument
|
||||||
|
/// to the associated parameter matches this value.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public bool ParameterValue { get; }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="DoesNotReturnIfAttribute"/>
|
||||||
|
/// class with the specified parameter value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameterValue">
|
||||||
|
/// The condition parameter value.
|
||||||
|
/// Code after the method is considered unreachable by diagnostics if the argument
|
||||||
|
/// to the associated parameter matches this value.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public DoesNotReturnIfAttribute(bool parameterValue)
|
||||||
|
{
|
||||||
|
ParameterValue = parameterValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that an output may be <see langword="null"/> even if the
|
||||||
|
/// corresponding type disallows it.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Field | AttributeTargets.Parameter |
|
||||||
|
AttributeTargets.Property | AttributeTargets.ReturnValue,
|
||||||
|
Inherited = false
|
||||||
|
)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class MaybeNullAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="MaybeNullAttribute"/> class.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public MaybeNullAttribute() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that when a method returns <see cref="ReturnValue"/>,
|
||||||
|
/// the parameter may be <see langword="null"/> even if the corresponding type disallows it.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class MaybeNullWhenAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the return value condition.
|
||||||
|
/// If the method returns this value, the associated parameter may be <see langword="null"/>.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public bool ReturnValue { get; }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the attribute with the specified return value condition.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="returnValue">
|
||||||
|
/// The return value condition.
|
||||||
|
/// If the method returns this value, the associated parameter may be <see langword="null"/>.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public MaybeNullWhenAttribute(bool returnValue)
|
||||||
|
{
|
||||||
|
ReturnValue = returnValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that the method or property will ensure that the listed field and property members have
|
||||||
|
/// not-<see langword="null"/> values.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class MemberNotNullAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Gets field or property member names.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public string[] Members { get; }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the attribute with a field or property member.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="member">
|
||||||
|
/// The field or property member that is promised to be not-null.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public MemberNotNullAttribute(string member)
|
||||||
|
{
|
||||||
|
Members = new[] { member };
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the attribute with the list of field and property members.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="members">
|
||||||
|
/// The list of field and property members that are promised to be not-null.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public MemberNotNullAttribute(params string[] members)
|
||||||
|
{
|
||||||
|
Members = members;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that the method or property will ensure that the listed field and property members have
|
||||||
|
/// non-<see langword="null"/> values when returning with the specified return value condition.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class MemberNotNullWhenAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the return value condition.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public bool ReturnValue { get; }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Gets field or property member names.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public string[] Members { get; }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the attribute with the specified return value condition and a field or property member.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="returnValue">
|
||||||
|
/// The return value condition. If the method returns this value,
|
||||||
|
/// the associated parameter will not be <see langword="null"/>.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="member">
|
||||||
|
/// The field or property member that is promised to be not-<see langword="null"/>.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public MemberNotNullWhenAttribute(bool returnValue, string member)
|
||||||
|
{
|
||||||
|
ReturnValue = returnValue;
|
||||||
|
Members = new[] { member };
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the attribute with the specified return value condition and list
|
||||||
|
/// of field and property members.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="returnValue">
|
||||||
|
/// The return value condition. If the method returns this value,
|
||||||
|
/// the associated parameter will not be <see langword="null"/>.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="members">
|
||||||
|
/// The list of field and property members that are promised to be not-null.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
|
||||||
|
{
|
||||||
|
ReturnValue = returnValue;
|
||||||
|
Members = members;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that an output is not <see langword="null"/> even if the
|
||||||
|
/// corresponding type allows it.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Field | AttributeTargets.Parameter |
|
||||||
|
AttributeTargets.Property | AttributeTargets.ReturnValue,
|
||||||
|
Inherited = false
|
||||||
|
)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class NotNullAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="NotNullAttribute"/> class.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public NotNullAttribute() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that the output will be non-<see langword="null"/> if the
|
||||||
|
/// named parameter is non-<see langword="null"/>.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue,
|
||||||
|
AllowMultiple = true,
|
||||||
|
Inherited = false
|
||||||
|
)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class NotNullIfNotNullAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the associated parameter name.
|
||||||
|
/// The output will be non-<see langword="null"/> if the argument to the
|
||||||
|
/// parameter specified is non-<see langword="null"/>.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public string ParameterName { get; }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the attribute with the associated parameter name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameterName">
|
||||||
|
/// The associated parameter name.
|
||||||
|
/// The output will be non-<see langword="null"/> if the argument to the
|
||||||
|
/// parameter specified is non-<see langword="null"/>.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public NotNullIfNotNullAttribute(string parameterName)
|
||||||
|
{
|
||||||
|
ParameterName = parameterName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
// <auto-generated>
|
||||||
|
// This code file has automatically been added by the "Nullable" NuGet package (https://www.nuget.org/packages/Nullable).
|
||||||
|
// Please see https://github.com/manuelroemer/Nullable for more information.
|
||||||
|
//
|
||||||
|
// IMPORTANT:
|
||||||
|
// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references.
|
||||||
|
// Consider migrating to PackageReferences instead:
|
||||||
|
// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference
|
||||||
|
// Migrating brings the following benefits:
|
||||||
|
// * The "Nullable" folder and the nullable "*Attribute.cs" files don't appear in your project.
|
||||||
|
// * The added files are immutable and can therefore not be modified by coincidence.
|
||||||
|
// * Updating/Uninstalling the package will work flawlessly.
|
||||||
|
// </auto-generated>
|
||||||
|
|
||||||
|
#region License
|
||||||
|
// MIT License
|
||||||
|
//
|
||||||
|
// Copyright (c) Manuel Römer
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
// SOFTWARE.
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#if !NULLABLE_ATTRIBUTES_DISABLE
|
||||||
|
#nullable enable
|
||||||
|
#pragma warning disable
|
||||||
|
|
||||||
|
namespace System.Diagnostics.CodeAnalysis
|
||||||
|
{
|
||||||
|
using global::System;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies that when a method returns <see cref="ReturnValue"/>,
|
||||||
|
/// the parameter will not be <see langword="null"/> even if the corresponding type allows it.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
|
||||||
|
#if !NULLABLE_ATTRIBUTES_INCLUDE_IN_CODE_COVERAGE
|
||||||
|
[DebuggerNonUserCode]
|
||||||
|
#endif
|
||||||
|
internal sealed class NotNullWhenAttribute : Attribute
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the return value condition.
|
||||||
|
/// If the method returns this value, the associated parameter will not be <see langword="null"/>.
|
||||||
|
/// </summary>
|
||||||
|
#endif
|
||||||
|
public bool ReturnValue { get; }
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the attribute with the specified return value condition.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="returnValue">
|
||||||
|
/// The return value condition.
|
||||||
|
/// If the method returns this value, the associated parameter will not be <see langword="null"/>.
|
||||||
|
/// </param>
|
||||||
|
#endif
|
||||||
|
public NotNullWhenAttribute(bool returnValue)
|
||||||
|
{
|
||||||
|
ReturnValue = returnValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma warning restore
|
||||||
|
#nullable restore
|
||||||
|
#endif // NULLABLE_ATTRIBUTES_DISABLE
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<HintPath>..\..\packages\AnyOf.0.3.0\lib\net45\AnyOf.dll</HintPath>
|
<HintPath>..\..\packages\AnyOf.0.3.0\lib\net45\AnyOf.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Fare, Version=2.2.0.0, Culture=neutral, PublicKeyToken=ea68d375bf33a7c8, processorArchitecture=MSIL">
|
<Reference Include="Fare, Version=2.2.0.0, Culture=neutral, PublicKeyToken=ea68d375bf33a7c8, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Fare.2.2.0\lib\net35\Fare.dll</HintPath>
|
<HintPath>..\..\packages\Fare.2.2.1\lib\net35\Fare.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Handlebars, Version=2.1.2.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661, processorArchitecture=MSIL">
|
<Reference Include="Handlebars, Version=2.1.2.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.2.1.2\lib\net46\Handlebars.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.2.1.2\lib\net46\Handlebars.dll</HintPath>
|
||||||
@@ -54,23 +54,23 @@
|
|||||||
<Reference Include="HandlebarsDotNet.Helpers.Core, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
<Reference Include="HandlebarsDotNet.Helpers.Core, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Core.2.3.5\lib\net452\HandlebarsDotNet.Helpers.Core.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.Helpers.Core.2.3.5\lib\net452\HandlebarsDotNet.Helpers.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HandlebarsDotNet.Helpers.DynamicLinq, Version=2.3.3.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
<Reference Include="HandlebarsDotNet.Helpers.DynamicLinq, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.DynamicLinq.2.3.3\lib\net452\HandlebarsDotNet.Helpers.DynamicLinq.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.Helpers.DynamicLinq.2.3.5\lib\net452\HandlebarsDotNet.Helpers.DynamicLinq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HandlebarsDotNet.Helpers.Humanizer, Version=2.3.3.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
<Reference Include="HandlebarsDotNet.Helpers.Humanizer, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Humanizer.2.3.3\lib\net452\HandlebarsDotNet.Helpers.Humanizer.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.Helpers.Humanizer.2.3.5\lib\net452\HandlebarsDotNet.Helpers.Humanizer.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HandlebarsDotNet.Helpers.Json, Version=2.3.3.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
<Reference Include="HandlebarsDotNet.Helpers.Json, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Json.2.3.3\lib\net452\HandlebarsDotNet.Helpers.Json.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.Helpers.Json.2.3.5\lib\net452\HandlebarsDotNet.Helpers.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HandlebarsDotNet.Helpers.Random, Version=2.3.3.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
<Reference Include="HandlebarsDotNet.Helpers.Random, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Random.2.3.3\lib\net452\HandlebarsDotNet.Helpers.Random.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.Helpers.Random.2.3.5\lib\net452\HandlebarsDotNet.Helpers.Random.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HandlebarsDotNet.Helpers.Xeger, Version=2.3.3.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
<Reference Include="HandlebarsDotNet.Helpers.Xeger, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.Xeger.2.3.3\lib\net452\HandlebarsDotNet.Helpers.Xeger.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.Helpers.Xeger.2.3.5\lib\net452\HandlebarsDotNet.Helpers.Xeger.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="HandlebarsDotNet.Helpers.XPath, Version=2.3.3.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
<Reference Include="HandlebarsDotNet.Helpers.XPath, Version=2.3.5.0, Culture=neutral, PublicKeyToken=00d131fae0c250bc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Handlebars.Net.Helpers.XPath.2.3.3\lib\net452\HandlebarsDotNet.Helpers.XPath.dll</HintPath>
|
<HintPath>..\..\packages\Handlebars.Net.Helpers.XPath.2.3.5\lib\net452\HandlebarsDotNet.Helpers.XPath.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Humanizer, Version=2.14.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
|
<Reference Include="Humanizer, Version=2.14.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Humanizer.Core.2.14.1\lib\netstandard2.0\Humanizer.dll</HintPath>
|
<HintPath>..\..\packages\Humanizer.Core.2.14.1\lib\netstandard2.0\Humanizer.dll</HintPath>
|
||||||
@@ -246,11 +246,23 @@
|
|||||||
<Reference Include="Microsoft.Net.Http.Headers, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\..\packages\Microsoft.Net.Http.Headers.2.2.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Namotion.Reflection, Version=2.0.10.0, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Namotion.Reflection.2.0.10\lib\net45\Namotion.Reflection.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RandomDataGenerator, Version=1.0.13.0, Culture=neutral, PublicKeyToken=ae5c571d29a3b8d9, processorArchitecture=MSIL">
|
<Reference Include="NJsonSchema, Version=10.6.10.0, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\RandomDataGenerator.Net.1.0.14\lib\net45\RandomDataGenerator.dll</HintPath>
|
<HintPath>..\..\packages\NJsonSchema.10.6.10\lib\net45\NJsonSchema.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="NJsonSchema.Extensions, Version=0.1.0.0, Culture=neutral, PublicKeyToken=e52fadf300daf456, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\NJsonSchema.Extensions.0.1.0\lib\net45\NJsonSchema.Extensions.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="NSwag.Core, Version=13.15.10.0, Culture=neutral, PublicKeyToken=c2d88086e098d109, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\NSwag.Core.13.15.10\lib\net45\NSwag.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="RandomDataGenerator, Version=1.0.15.0, Culture=neutral, PublicKeyToken=ae5c571d29a3b8d9, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\RandomDataGenerator.Net.1.0.16\lib\net45\RandomDataGenerator.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Scriban.Signed, Version=2.1.4.0, Culture=neutral, PublicKeyToken=5675fb69b15f2433, processorArchitecture=MSIL">
|
<Reference Include="Scriban.Signed, Version=2.1.4.0, Culture=neutral, PublicKeyToken=5675fb69b15f2433, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Scriban.Signed.2.1.4\lib\net45\Scriban.Signed.dll</HintPath>
|
<HintPath>..\..\packages\Scriban.Signed.2.1.4\lib\net45\Scriban.Signed.dll</HintPath>
|
||||||
@@ -289,6 +301,10 @@
|
|||||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Net" />
|
||||||
|
<Reference Include="System.Net.Http.Formatting, Version=5.2.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\packages\Microsoft.AspNet.WebApi.Client.5.2.8\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Net.Http.WebRequest" />
|
<Reference Include="System.Net.Http.WebRequest" />
|
||||||
<Reference Include="System.Numerics" />
|
<Reference Include="System.Numerics" />
|
||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
@@ -300,6 +316,7 @@
|
|||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
<Reference Include="System.Security.Cryptography.Cng, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Security.Cryptography.Cng, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\System.Security.Cryptography.Cng.4.5.0\lib\net47\System.Security.Cryptography.Cng.dll</HintPath>
|
<HintPath>..\..\packages\System.Security.Cryptography.Cng.4.5.0\lib\net47\System.Security.Cryptography.Cng.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -325,15 +342,6 @@
|
|||||||
<Reference Include="TinyMapper, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="TinyMapper, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\TinyMapper.3.0.3\lib\net40\TinyMapper.dll</HintPath>
|
<HintPath>..\..\packages\TinyMapper.3.0.3\lib\net40\TinyMapper.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="WireMock.Net, Version=1.4.41.0, Culture=neutral, PublicKeyToken=c8d65537854e1f03, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\packages\WireMock.Net.1.4.41\lib\net461\WireMock.Net.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="WireMock.Net.Abstractions, Version=1.4.41.0, Culture=neutral, PublicKeyToken=c8d65537854e1f03, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\packages\WireMock.Net.Abstractions.1.4.41\lib\net451\WireMock.Net.Abstractions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="WireMock.Org.Abstractions, Version=1.4.41.0, Culture=neutral, PublicKeyToken=c8d65537854e1f03, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\..\packages\WireMock.Org.Abstractions.1.4.41\lib\net45\WireMock.Org.Abstractions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="XPath2, Version=1.1.3.0, Culture=neutral, PublicKeyToken=463c6d7fb740c7e5, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\..\packages\XPath2.1.1.3\lib\net452\XPath2.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -351,6 +359,17 @@
|
|||||||
<Compile Include="..\WireMock.Net.Console.Net452.Classic\Program.cs">
|
<Compile Include="..\WireMock.Net.Console.Net452.Classic\Program.cs">
|
||||||
<Link>Program.cs</Link>
|
<Link>Program.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Nullable\AllowNullAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\DisallowNullAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\DoesNotReturnAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\DoesNotReturnIfAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\MaybeNullAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\MaybeNullWhenAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\MemberNotNullAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\MemberNotNullWhenAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\NotNullAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\NotNullIfNotNullAttribute.cs" />
|
||||||
|
<Compile Include="Nullable\NotNullWhenAttribute.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -360,6 +379,16 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</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" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="AnyOf" version="0.3.0" targetFramework="net472" />
|
<package id="AnyOf" version="0.3.0" targetFramework="net472" />
|
||||||
<package id="Fare" version="2.2.0" targetFramework="net472" />
|
<package id="Fare" version="2.2.1" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net" version="2.1.2" targetFramework="net472" />
|
<package id="Handlebars.Net" version="2.1.2" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers" version="2.3.5" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers.Core" version="2.3.5" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers.Core" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers.DynamicLinq" version="2.3.3" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers.DynamicLinq" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers.Humanizer" version="2.3.3" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers.Humanizer" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers.Json" version="2.3.3" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers.Json" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers.Random" version="2.3.3" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers.Random" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers.Xeger" version="2.3.3" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers.Xeger" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Handlebars.Net.Helpers.XPath" version="2.3.3" targetFramework="net472" />
|
<package id="Handlebars.Net.Helpers.XPath" version="2.3.5" targetFramework="net472" />
|
||||||
<package id="Humanizer" version="2.14.1" targetFramework="net472" />
|
<package id="Humanizer" version="2.14.1" targetFramework="net472" />
|
||||||
<package id="Humanizer.Core" version="2.14.1" targetFramework="net472" />
|
<package id="Humanizer.Core" version="2.14.1" targetFramework="net472" />
|
||||||
<package id="Humanizer.Core.af" version="2.14.1" targetFramework="net472" />
|
<package id="Humanizer.Core.af" version="2.14.1" targetFramework="net472" />
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
<package id="Humanizer.Core.zh-Hant" version="2.14.1" targetFramework="net472" />
|
<package id="Humanizer.Core.zh-Hant" version="2.14.1" targetFramework="net472" />
|
||||||
<package id="JmesPath.Net" version="1.0.125" targetFramework="net472" />
|
<package id="JmesPath.Net" version="1.0.125" targetFramework="net472" />
|
||||||
<package id="log4net" version="2.0.14" targetFramework="net472" />
|
<package id="log4net" version="2.0.14" targetFramework="net472" />
|
||||||
|
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.8" targetFramework="net472" />
|
||||||
<package id="Microsoft.AspNetCore" version="2.2.0" targetFramework="net472" />
|
<package id="Microsoft.AspNetCore" version="2.2.0" targetFramework="net472" />
|
||||||
<package id="Microsoft.AspNetCore.Authentication.Abstractions" version="2.2.0" targetFramework="net472" />
|
<package id="Microsoft.AspNetCore.Authentication.Abstractions" version="2.2.0" targetFramework="net472" />
|
||||||
<package id="Microsoft.AspNetCore.Authentication.Core" version="2.2.0" targetFramework="net472" />
|
<package id="Microsoft.AspNetCore.Authentication.Core" version="2.2.0" targetFramework="net472" />
|
||||||
@@ -119,8 +120,13 @@
|
|||||||
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.12.2" targetFramework="net472" />
|
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.12.2" targetFramework="net472" />
|
||||||
<package id="Microsoft.IdentityModel.Tokens" version="6.12.2" targetFramework="net472" />
|
<package id="Microsoft.IdentityModel.Tokens" version="6.12.2" targetFramework="net472" />
|
||||||
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net472" />
|
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net472" />
|
||||||
|
<package id="Namotion.Reflection" version="2.0.10" targetFramework="net472" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
|
||||||
<package id="RandomDataGenerator.Net" version="1.0.14" targetFramework="net472" />
|
<package id="NJsonSchema" version="10.6.10" targetFramework="net472" />
|
||||||
|
<package id="NJsonSchema.Extensions" version="0.1.0" targetFramework="net472" />
|
||||||
|
<package id="NSwag.Core" version="13.15.10" targetFramework="net472" />
|
||||||
|
<package id="Nullable" version="1.3.0" targetFramework="net472" developmentDependency="true" />
|
||||||
|
<package id="RandomDataGenerator.Net" version="1.0.16" targetFramework="net472" />
|
||||||
<package id="Scriban.Signed" version="2.1.4" targetFramework="net472" />
|
<package id="Scriban.Signed" version="2.1.4" targetFramework="net472" />
|
||||||
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net461" />
|
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net461" />
|
||||||
<package id="Stef.Validation" version="0.1.0" targetFramework="net472" />
|
<package id="Stef.Validation" version="0.1.0" targetFramework="net472" />
|
||||||
@@ -141,9 +147,6 @@
|
|||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
|
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
|
||||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||||
<package id="TinyMapper" version="3.0.3" targetFramework="net472" />
|
<package id="TinyMapper" version="3.0.3" targetFramework="net472" />
|
||||||
<package id="WireMock.Net" version="1.4.41" targetFramework="net472" />
|
|
||||||
<package id="WireMock.Net.Abstractions" version="1.4.41" targetFramework="net472" />
|
|
||||||
<package id="WireMock.Org.Abstractions" version="1.4.41" targetFramework="net472" />
|
|
||||||
<package id="XPath2" version="1.1.3" targetFramework="net472" />
|
<package id="XPath2" version="1.1.3" targetFramework="net472" />
|
||||||
<package id="XPath2.Extensions" version="1.1.3" targetFramework="net472" />
|
<package id="XPath2.Extensions" version="1.1.3" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||||
</startup>
|
</startup>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@@ -8,9 +8,10 @@
|
|||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RootNamespace>WireMock.Net.Service</RootNamespace>
|
<RootNamespace>WireMock.Net.Service</RootNamespace>
|
||||||
<AssemblyName>WireMock.Net.Service</AssemblyName>
|
<AssemblyName>WireMock.Net.Service</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net452" />
|
||||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||||
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net452" />
|
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net452" />
|
||||||
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" />
|
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" requireReinstallation="true" />
|
||||||
<package id="XPath2" version="1.1.3" targetFramework="net452" />
|
<package id="XPath2" version="1.1.3" targetFramework="net452" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -1,8 +1,16 @@
|
|||||||
{
|
{
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"WireMock.Net.StandAlone.NETCoreApp": {
|
"WireMock.Net.StandAlone.NETCoreApp": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "--Urls http://localhost:9091 --CorsPolicyOptions AllowAll --WireMockLogger WireMockConsoleLogger"
|
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,26 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
|
|
||||||
namespace WireMock.Net.StandAlone.Net452
|
namespace WireMock.Net.StandAlone.Net452;
|
||||||
|
|
||||||
|
public class Program
|
||||||
{
|
{
|
||||||
public class Program
|
static void Main(params string[] args)
|
||||||
{
|
{
|
||||||
static void Main(params string[] args)
|
XmlConfigurator.Configure(new FileInfo("log4net.config"));
|
||||||
|
|
||||||
|
if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
|
||||||
{
|
{
|
||||||
XmlConfigurator.Configure(new FileInfo("log4net.config"));
|
Console.WriteLine("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
|
||||||
|
|
||||||
if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
|
WireMockServer.Start(settings);
|
||||||
{
|
|
||||||
settings.Logger.Debug("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();
|
||||||
Console.WriteLine("Press any key to stop the server");
|
|
||||||
Console.ReadKey();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
|
|
||||||
namespace WireMock.Net.StandAlone.Net461
|
namespace WireMock.Net.StandAlone.Net461;
|
||||||
|
|
||||||
|
static class Program
|
||||||
{
|
{
|
||||||
static class Program
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
|
||||||
{
|
{
|
||||||
if (WireMockServerSettingsParser.TryParseArguments(args, out var settings))
|
Console.WriteLine("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
|
||||||
{
|
|
||||||
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
|
|
||||||
|
|
||||||
WireMockServer.Start(settings);
|
WireMockServer.Start(settings);
|
||||||
|
|
||||||
Console.WriteLine("Press any key to stop the server");
|
Console.WriteLine("Press any key to stop the server");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,8 +204,8 @@
|
|||||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="RestEase, Version=1.5.5.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RestEase, Version=1.5.7.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\packages\RestEase.1.5.5\lib\net45\RestEase.dll</HintPath>
|
<HintPath>..\..\packages\RestEase.1.5.7\lib\net452\RestEase.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimMetrics.Net, Version=1.0.5.0, Culture=neutral, PublicKeyToken=c58dc06d59f3391b, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\..\packages\SimMetrics.Net.1.0.5\lib\net45\SimMetrics.Net.dll</HintPath>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<package id="Microsoft.AspNetCore.Hosting" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Hosting" version="2.1.1" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.1.1" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.1.1" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Http" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Http" version="2.1.22" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Http.Abstractions" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Http.Abstractions" version="2.1.1" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Http.Extensions" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Http.Extensions" version="2.1.1" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Http.Features" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Http.Features" version="2.1.1" targetFramework="net461" />
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<package id="Microsoft.AspNetCore.Routing.Abstractions" version="2.1.1" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Routing.Abstractions" version="2.1.1" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Server.IISIntegration" version="2.1.2" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Server.IISIntegration" version="2.1.2" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Server.Kestrel" version="2.1.3" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Server.Kestrel" version="2.1.3" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.1.3" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.1.25" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.1.3" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.1.3" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.1.3" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.1.3" targetFramework="net461" />
|
||||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.1.3" targetFramework="net461" />
|
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.1.3" targetFramework="net461" />
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
<package id="MimeKitLite" version="2.0.7" targetFramework="net461" />
|
<package id="MimeKitLite" version="2.0.7" targetFramework="net461" />
|
||||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
|
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
|
||||||
<package id="Owin" version="1.0" targetFramework="net461" />
|
<package id="Owin" version="1.0" targetFramework="net461" />
|
||||||
<package id="RestEase" version="1.5.5" targetFramework="net461" />
|
<package id="RestEase" version="1.5.7" targetFramework="net461" />
|
||||||
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net461" />
|
<package id="SimMetrics.Net" version="1.0.5" targetFramework="net461" />
|
||||||
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
|
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
|
||||||
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
|
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
|
||||||
|
|||||||
@@ -0,0 +1,173 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"metadata": {
|
||||||
|
"_dependencyType": "compute.function.linux.appService"
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"resourceGroupName": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "linux-app-service",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resourceGroupLocation": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "westeurope",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resourceName": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "WireMockNetWebApplicationNET6Linux",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the main resource to be created by this template."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resourceLocation": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "[parameters('resourceGroupLocation')]",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Resources/resourceGroups",
|
||||||
|
"name": "[parameters('resourceGroupName')]",
|
||||||
|
"location": "[parameters('resourceGroupLocation')]",
|
||||||
|
"apiVersion": "2019-10-01"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Resources/deployments",
|
||||||
|
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
|
||||||
|
"resourceGroup": "[parameters('resourceGroupName')]",
|
||||||
|
"apiVersion": "2019-10-01",
|
||||||
|
"dependsOn": [
|
||||||
|
"[parameters('resourceGroupName')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"mode": "Incremental",
|
||||||
|
"expressionEvaluationOptions": {
|
||||||
|
"scope": "inner"
|
||||||
|
},
|
||||||
|
"parameters": {
|
||||||
|
"resourceGroupName": {
|
||||||
|
"value": "[parameters('resourceGroupName')]"
|
||||||
|
},
|
||||||
|
"resourceGroupLocation": {
|
||||||
|
"value": "[parameters('resourceGroupLocation')]"
|
||||||
|
},
|
||||||
|
"resourceName": {
|
||||||
|
"value": "[parameters('resourceName')]"
|
||||||
|
},
|
||||||
|
"resourceLocation": {
|
||||||
|
"value": "[parameters('resourceLocation')]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"template": {
|
||||||
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"resourceGroupName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"resourceGroupLocation": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"resourceName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"resourceLocation": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"storage_name": "[toLower(concat('storage', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId))))]",
|
||||||
|
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
|
||||||
|
"storage_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Storage/storageAccounts/', variables('storage_name'))]",
|
||||||
|
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]",
|
||||||
|
"function_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/sites/', parameters('resourceName'))]"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"location": "[parameters('resourceLocation')]",
|
||||||
|
"name": "[parameters('resourceName')]",
|
||||||
|
"type": "Microsoft.Web/sites",
|
||||||
|
"apiVersion": "2015-08-01",
|
||||||
|
"tags": {
|
||||||
|
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
|
||||||
|
},
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('appServicePlan_ResourceId')]",
|
||||||
|
"[variables('storage_ResourceId')]"
|
||||||
|
],
|
||||||
|
"kind": "functionapp",
|
||||||
|
"properties": {
|
||||||
|
"name": "[parameters('resourceName')]",
|
||||||
|
"kind": "functionapp",
|
||||||
|
"httpsOnly": true,
|
||||||
|
"reserved": false,
|
||||||
|
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
|
||||||
|
"siteConfig": {
|
||||||
|
"alwaysOn": true,
|
||||||
|
"linuxFxVersion": "dotnet|3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"identity": {
|
||||||
|
"type": "SystemAssigned"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"name": "appsettings",
|
||||||
|
"type": "config",
|
||||||
|
"apiVersion": "2015-08-01",
|
||||||
|
"dependsOn": [
|
||||||
|
"[variables('function_ResourceId')]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storage_name'), ';AccountKey=', listKeys(variables('storage_ResourceId'), '2017-10-01').keys[0].value, ';EndpointSuffix=', 'core.windows.net')]",
|
||||||
|
"FUNCTIONS_EXTENSION_VERSION": "~3",
|
||||||
|
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "[parameters('resourceGroupLocation')]",
|
||||||
|
"name": "[variables('storage_name')]",
|
||||||
|
"type": "Microsoft.Storage/storageAccounts",
|
||||||
|
"apiVersion": "2017-10-01",
|
||||||
|
"tags": {
|
||||||
|
"[concat('hidden-related:', concat('/providers/Microsoft.Web/sites/', parameters('resourceName')))]": "empty"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"supportsHttpsTrafficOnly": true
|
||||||
|
},
|
||||||
|
"sku": {
|
||||||
|
"name": "Standard_LRS"
|
||||||
|
},
|
||||||
|
"kind": "Storage"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"location": "[parameters('resourceGroupLocation')]",
|
||||||
|
"name": "[variables('appServicePlan_name')]",
|
||||||
|
"type": "Microsoft.Web/serverFarms",
|
||||||
|
"apiVersion": "2015-02-01",
|
||||||
|
"kind": "linux",
|
||||||
|
"properties": {
|
||||||
|
"name": "[variables('appServicePlan_name')]",
|
||||||
|
"sku": "Standard",
|
||||||
|
"workerSizeId": "0",
|
||||||
|
"reserved": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,33 +1,29 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6</TargetFramework>
|
<TargetFramework>net6</TargetFramework>
|
||||||
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
|
<!--<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>-->
|
||||||
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
|
<StartupObject>WireMock.Net.WebApplication.Program</StartupObject>
|
||||||
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
|
<AssemblyName>WireMock.Net.WebApplication</AssemblyName>
|
||||||
<RootNamespace>WireMock.Net.WebApplication</RootNamespace>
|
<RootNamespace>WireMock.Net.WebApplication</RootNamespace>
|
||||||
<UserSecretsId>efcf4a18-fd7c-4622-1111-336d65290599</UserSecretsId>
|
<UserSecretsId>efcf4a18-fd7c-4622-1111-336d65290599</UserSecretsId>
|
||||||
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
|
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Remove="Properties\1.launchSettings.json" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
|
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
<Content Update="appsettings.json">
|
||||||
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</ItemGroup>
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Content Update="appsettings.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -15,15 +15,7 @@
|
|||||||
"WireMockServerSettings": {
|
"WireMockServerSettings": {
|
||||||
"StartAdminInterface": true,
|
"StartAdminInterface": true,
|
||||||
"Urls": [
|
"Urls": [
|
||||||
"https://localhost:8081/"
|
"http://localhost"
|
||||||
],
|
]
|
||||||
"AllowPartialMapping": false,
|
|
||||||
"HandleRequestsSynchronously": true,
|
|
||||||
"ThrowExceptionWhenMatcherFails": true,
|
|
||||||
"ProxyAndRecordSettings": {
|
|
||||||
"Url": "http://postman-echo.com/post",
|
|
||||||
"SaveMapping": true,
|
|
||||||
"SaveMappingToFile": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0'">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0'">
|
||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1'">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1'">
|
||||||
|
|||||||
264
examples/WireMockAzureQueueExample/.gitignore
vendored
Normal file
264
examples/WireMockAzureQueueExample/.gitignore
vendored
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# Azure Functions localsettings file
|
||||||
|
local.settings.json
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# DNX
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
#*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignoreable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
node_modules/
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush
|
||||||
|
.cr/
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
13
examples/WireMockAzureQueueExample/Function1.cs
Normal file
13
examples/WireMockAzureQueueExample/Function1.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using Microsoft.Azure.WebJobs;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace WireMockAzureQueueExample;
|
||||||
|
|
||||||
|
public class Function1
|
||||||
|
{
|
||||||
|
[FunctionName("Function1")]
|
||||||
|
public void Run([QueueTrigger("myqueue-items", Connection = "ConnectionStringToWireMock")]string myQueueItem, ILogger log)
|
||||||
|
{
|
||||||
|
log.LogWarning($"C# Queue trigger function processed: {myQueueItem}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"WireMockAzureQueueExample": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"commandLineArgs": "--port 7290",
|
||||||
|
"launchBrowser": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"appInsights1": {
|
||||||
|
"type": "appInsights"
|
||||||
|
},
|
||||||
|
"secrets1": {
|
||||||
|
"type": "secrets"
|
||||||
|
},
|
||||||
|
"storage1": {
|
||||||
|
"type": "storage",
|
||||||
|
"connectionId": "AzureWebJobsStorage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"appInsights1": {
|
||||||
|
"type": "appInsights.sdk"
|
||||||
|
},
|
||||||
|
"secrets1": {
|
||||||
|
"type": "secrets.user"
|
||||||
|
},
|
||||||
|
"storage1": {
|
||||||
|
"secretStore": null,
|
||||||
|
"resourceId": null,
|
||||||
|
"type": "storage.emulator",
|
||||||
|
"connectionId": "AzureWebJobsStorage"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
|
||||||
|
<UserSecretsId>bb7d8355-68c4-4f81-8c2d-6cdd80cd7602</UserSecretsId>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.1" />
|
||||||
|
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.12.1" />
|
||||||
|
<PackageReference Include="Azure.Storage.Queues" Version="12.12.0" />
|
||||||
|
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.5" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="host.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="local.settings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
11
examples/WireMockAzureQueueExample/host.json
Normal file
11
examples/WireMockAzureQueueExample/host.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0",
|
||||||
|
"logging": {
|
||||||
|
"applicationInsights": {
|
||||||
|
"samplingSettings": {
|
||||||
|
"isEnabled": true,
|
||||||
|
"excludedTypes": "Request"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
examples/WireMockAzureQueueExample/local.settings.json
Normal file
7
examples/WireMockAzureQueueExample/local.settings.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"IsEncrypted": false,
|
||||||
|
"Values": {
|
||||||
|
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
|
||||||
|
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
|
||||||
|
}
|
||||||
|
}
|
||||||
40
examples/WireMockAzureQueueProxy/Program.cs
Normal file
40
examples/WireMockAzureQueueProxy/Program.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using WireMock.Logging;
|
||||||
|
using WireMock.Server;
|
||||||
|
using WireMock.Settings;
|
||||||
|
|
||||||
|
namespace WireMockAzureQueueProxy;
|
||||||
|
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
static void Main(params string[] args)
|
||||||
|
{
|
||||||
|
var server = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
{
|
||||||
|
Logger = new WireMockConsoleLogger(),
|
||||||
|
Urls = new[] { "http://localhost:20001/" },
|
||||||
|
StartAdminInterface = false,
|
||||||
|
ReadStaticMappings = true,
|
||||||
|
WatchStaticMappings = true,
|
||||||
|
WatchStaticMappingsInSubdirectories = true,
|
||||||
|
//ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||||
|
//{
|
||||||
|
// Url = "http://127.0.0.1:10001",
|
||||||
|
// SaveMapping = true,
|
||||||
|
// SaveMappingToFile = true,
|
||||||
|
// AppendGuidToSavedMappingFile = true
|
||||||
|
//}
|
||||||
|
});
|
||||||
|
|
||||||
|
System.Console.WriteLine("Press any key to stop the server");
|
||||||
|
System.Console.ReadKey();
|
||||||
|
server.Stop();
|
||||||
|
|
||||||
|
System.Console.WriteLine("Displaying all requests");
|
||||||
|
var allRequests = server.LogEntries;
|
||||||
|
System.Console.WriteLine(JsonConvert.SerializeObject(allRequests, Formatting.Indented));
|
||||||
|
|
||||||
|
System.Console.WriteLine("Press any key to quit");
|
||||||
|
System.Console.ReadKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\WireMock.Net\WireMock.Net.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="__admin\mappings\*.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"Guid": "b4a2ff02-fb7f-4496-8c04-9aafc4f5f8f7",
|
||||||
|
"Title": "Proxy Mapping for DELETE /devstoreaccount1/myqueue-items/messages/41b2aadc-d6ea-4c3c-ae20-2ae72eb08d88",
|
||||||
|
"Description": "Proxy Mapping for DELETE /devstoreaccount1/myqueue-items/messages/41b2aadc-d6ea-4c3c-ae20-2ae72eb08d88",
|
||||||
|
"Request": {
|
||||||
|
"Path": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/devstoreaccount1/myqueue-items/messages/41b2aadc-d6ea-4c3c-ae20-2ae72eb08d88",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Methods": [
|
||||||
|
"DELETE"
|
||||||
|
],
|
||||||
|
"Params": [
|
||||||
|
{
|
||||||
|
"Name": "popreceipt",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "*",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"StatusCode": 204,
|
||||||
|
"Headers": {
|
||||||
|
"Server": "Azurite-Queue/3.19.0",
|
||||||
|
"x-ms-client-request-id": "{{request.headers.x-ms-client-request-id}}",
|
||||||
|
"x-ms-request-id": "{{Random Type=\"Guid\"}}",
|
||||||
|
"x-ms-version": "2021-10-04",
|
||||||
|
"Date": "{{DateTime.Now \"ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’\"}}",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Keep-Alive": "timeout=5"
|
||||||
|
},
|
||||||
|
"UseTransformer": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"Scenario": "AzureQueue Get Messages",
|
||||||
|
"WhenStateIs": "No more messages",
|
||||||
|
"SetStateTo": "No more messages",
|
||||||
|
"Guid": "4c871968-29ee-472b-a548-170444d4cc3e",
|
||||||
|
"Title": "Proxy Mapping for GET NO MSG /devstoreaccount1/myqueue-items/messages",
|
||||||
|
"Description": "Proxy Mapping for GET NO MSG /devstoreaccount1/myqueue-items/messages",
|
||||||
|
"Request": {
|
||||||
|
"Path": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/devstoreaccount1/myqueue-items/messages",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Methods": [
|
||||||
|
"GET"
|
||||||
|
],
|
||||||
|
"Params": [
|
||||||
|
{
|
||||||
|
"Name": "numofmessages",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "ExactMatcher",
|
||||||
|
"Pattern": "16",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "visibilitytimeout",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "ExactMatcher",
|
||||||
|
"Pattern": "600",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"StatusCode": 200,
|
||||||
|
"Body": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><QueueMessagesList/>",
|
||||||
|
"Headers": {
|
||||||
|
"Content-Type": "application/xml",
|
||||||
|
"Server": "Azurite-Queue/3.19.0",
|
||||||
|
"x-ms-client-request-id": "{{request.headers.x-ms-client-request-id}}",
|
||||||
|
"x-ms-request-id": "{{Random Type=\"Guid\"}}",
|
||||||
|
"x-ms-version": "2021-10-04",
|
||||||
|
"Date": "{{DateTime.Now \"ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’\"}}",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Keep-Alive": "timeout=5",
|
||||||
|
"Transfer-Encoding": "chunked"
|
||||||
|
},
|
||||||
|
"UseTransformer": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"Scenario": "AzureQueue Get Messages",
|
||||||
|
"SetStateTo": "No more messages",
|
||||||
|
"Guid": "da9c6799-fbf8-41b6-8933-0df50f821ebb",
|
||||||
|
"Title": "Proxy Mapping for GET /devstoreaccount1/myqueue-items/messages",
|
||||||
|
"Description": "Proxy Mapping for GET /devstoreaccount1/myqueue-items/messages",
|
||||||
|
"Request": {
|
||||||
|
"Path": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/devstoreaccount1/myqueue-items/messages",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Methods": [
|
||||||
|
"GET"
|
||||||
|
],
|
||||||
|
"Params": [
|
||||||
|
{
|
||||||
|
"Name": "numofmessages",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "*",
|
||||||
|
"IgnoreCase": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "visibilitytimeout",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "*",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"StatusCode": 200,
|
||||||
|
"Body": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><QueueMessagesList><QueueMessage><MessageId>41b2aadc-d6ea-4c3c-ae20-2ae72eb08d88</MessageId><InsertionTime>Sat, 29 Oct 2022 07:11:40 GMT</InsertionTime><ExpirationTime>Sat, 31 Dec 2022 07:11:40 GMT</ExpirationTime><PopReceipt>MjlPY3QyMDIyMDc6MTE6NDAyMjU2</PopReceipt><TimeNextVisible>Sat, 29 Oct 2022 07:21:40 GMT</TimeNextVisible><DequeueCount>1</DequeueCount><MessageText>c3RlZg==</MessageText></QueueMessage></QueueMessagesList>",
|
||||||
|
"Headers": {
|
||||||
|
"Content-Type": "application/xml",
|
||||||
|
"Server": "Azurite-Queue/3.19.0",
|
||||||
|
"x-ms-client-request-id": "{{request.headers.x-ms-client-request-id}}",
|
||||||
|
"x-ms-request-id": "{{Random Type=\"Guid\"}}",
|
||||||
|
"x-ms-version": "2021-10-04",
|
||||||
|
"Date": "{{DateTime.Now \"ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’\"}}",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Keep-Alive": "timeout=5",
|
||||||
|
"Transfer-Encoding": "chunked"
|
||||||
|
},
|
||||||
|
"UseTransformer": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"Guid": "17c7a389-98e1-4383-975d-54c82d1e3860",
|
||||||
|
"Title": "Proxy Mapping for HEAD /devstoreaccount1/myqueue-items",
|
||||||
|
"Description": "Proxy Mapping for HEAD /devstoreaccount1/myqueue-items",
|
||||||
|
"Request": {
|
||||||
|
"Path": {
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "WildcardMatcher",
|
||||||
|
"Pattern": "/devstoreaccount1/myqueue-items",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Methods": [
|
||||||
|
"HEAD"
|
||||||
|
],
|
||||||
|
"Params": [
|
||||||
|
{
|
||||||
|
"Name": "comp",
|
||||||
|
"Matchers": [
|
||||||
|
{
|
||||||
|
"Name": "ExactMatcher",
|
||||||
|
"Pattern": "metadata",
|
||||||
|
"IgnoreCase": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Response": {
|
||||||
|
"StatusCode": 200,
|
||||||
|
"Body": "",
|
||||||
|
"Headers": {
|
||||||
|
"Server": "Azurite-Queue/3.19.0",
|
||||||
|
"x-ms-client-request-id": "{{request.headers.x-ms-client-request-id}}",
|
||||||
|
"x-ms-approximate-messages-count": "0",
|
||||||
|
"x-ms-request-id": "{{Random Type=\"Guid\"}}",
|
||||||
|
"x-ms-version": "2021-10-04",
|
||||||
|
"Date": "{{DateTime.Now \"ddd, dd MMM yyy HH’:’mm’:’ss ‘GMT’\"}}",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Keep-Alive": "timeout=5"
|
||||||
|
},
|
||||||
|
"UseTransformer": true
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 14 KiB |
@@ -1,31 +1,39 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace WireMock.Admin.Mappings
|
namespace WireMock.Admin.Mappings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cookie Model
|
||||||
|
/// </summary>
|
||||||
|
[FluentBuilder.AutoGenerateBuilder]
|
||||||
|
public class CookieModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cookie Model
|
/// Gets or sets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[FluentBuilder.AutoGenerateBuilder]
|
public string Name { get; set; } = null!;
|
||||||
public class CookieModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the name.
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the matchers.
|
/// Gets or sets the matchers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<MatcherModel>? Matchers { get; set; }
|
public IList<MatcherModel>? Matchers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ignore case.
|
/// Gets or sets the ignore case.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IgnoreCase { get; set; }
|
public bool? IgnoreCase { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reject on match.
|
/// Reject on match.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? RejectOnMatch { get; set; }
|
public bool? RejectOnMatch { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Operator to use when matchers are defined. [Optional]
|
||||||
|
/// - null = Same as "or".
|
||||||
|
/// - "or" = Only one pattern should match.
|
||||||
|
/// - "and" = All patterns should match.
|
||||||
|
/// - "average" = The average value from all patterns.
|
||||||
|
/// </summary>
|
||||||
|
public string? MatchOperator { get; set; }
|
||||||
}
|
}
|
||||||
@@ -74,4 +74,9 @@ public class MappingModel
|
|||||||
/// The Webhooks.
|
/// The Webhooks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WebhookModel[]? Webhooks { get; set; }
|
public WebhookModel[]? Webhooks { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fire and forget for webhooks.
|
||||||
|
/// </summary>
|
||||||
|
public bool? UseWebhooksFireAndForget { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,48 +1,52 @@
|
|||||||
namespace WireMock.Admin.Mappings
|
namespace WireMock.Admin.Mappings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MatcherModel
|
||||||
|
/// </summary>
|
||||||
|
[FluentBuilder.AutoGenerateBuilder]
|
||||||
|
public class MatcherModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MatcherModel
|
/// Gets or sets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[FluentBuilder.AutoGenerateBuilder]
|
public string Name { get; set; } = null!;
|
||||||
public class MatcherModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the name.
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the pattern. Can be a string (default) or an object.
|
/// Gets or sets the pattern. Can be a string (default) or an object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object? Pattern { get; set; }
|
public object? Pattern { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the patterns. Can be array of strings (default) or an array of objects.
|
/// Gets or sets the patterns. Can be array of strings (default) or an array of objects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object[]? Patterns { get; set; }
|
public object[]? Patterns { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the pattern as a file.
|
/// Gets or sets the pattern as a file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? PatternAsFile { get; set; }
|
public string? PatternAsFile { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the ignore case.
|
/// Gets or sets the ignore case.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IgnoreCase { get; set; }
|
public bool? IgnoreCase { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reject on match.
|
/// Reject on match.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? RejectOnMatch { get; set; }
|
public bool? RejectOnMatch { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Operator to use when multiple patterns are defined. Optional.
|
/// The Operator to use when multiple patterns are defined. Optional.
|
||||||
/// - null = Same as "or".
|
/// - null = Same as "or".
|
||||||
/// - "or" = Only one pattern should match.
|
/// - "or" = Only one pattern should match.
|
||||||
/// - "and" = All patterns should match.
|
/// - "and" = All patterns should match.
|
||||||
/// - "average" = The average value from all patterns.
|
/// - "average" = The average value from all patterns.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? MatchOperator { get; set; }
|
public string? MatchOperator { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Support Regex, only used for JsonPartialMatcher.
|
||||||
|
/// </summary>
|
||||||
|
public bool? Regex { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
namespace WireMock.Admin.Mappings
|
namespace WireMock.Admin.Mappings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WebProxy settings
|
||||||
|
/// </summary>
|
||||||
|
[FluentBuilder.AutoGenerateBuilder]
|
||||||
|
public class WebProxyModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// WebProxy settings
|
/// A string instance that contains the address of the proxy server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[FluentBuilder.AutoGenerateBuilder]
|
public string Address { get; set; } = null!;
|
||||||
public class WebProxyModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A string instance that contains the address of the proxy server.
|
|
||||||
/// </summary>
|
|
||||||
public string Address { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user name associated with the credentials.
|
/// The user name associated with the credentials. [optional]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UserName { get; set; }
|
public string? UserName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The password for the user name associated with the credentials.
|
/// The password for the user name associated with the credentials. [optional]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Password { get; set; }
|
public string? Password { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
namespace WireMock.Admin.Mappings
|
namespace WireMock.Admin.Mappings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Webhook
|
||||||
|
/// </summary>
|
||||||
|
[FluentBuilder.AutoGenerateBuilder]
|
||||||
|
public class WebhookModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Webhook
|
/// The Webhook Request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[FluentBuilder.AutoGenerateBuilder]
|
public WebhookRequestModel Request { get; set; } = null!;
|
||||||
public class WebhookModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The Webhook Request.
|
|
||||||
/// </summary>
|
|
||||||
public WebhookRequestModel Request { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,52 +1,65 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using WireMock.Types;
|
|
||||||
|
|
||||||
namespace WireMock.Admin.Mappings
|
namespace WireMock.Admin.Mappings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// RequestModel
|
||||||
|
/// </summary>
|
||||||
|
[FluentBuilder.AutoGenerateBuilder]
|
||||||
|
public class WebhookRequestModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// RequestModel
|
/// Gets or sets the Url.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[FluentBuilder.AutoGenerateBuilder]
|
public string Url { get; set; } = null!;
|
||||||
public class WebhookRequestModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the Url.
|
|
||||||
/// </summary>
|
|
||||||
public string Url { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The methods
|
/// The method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Method { get; set; }
|
public string Method { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the headers.
|
/// Gets or sets the headers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IDictionary<string, string> Headers { get; set; }
|
public IDictionary<string, string>? Headers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the body.
|
/// Gets or sets the body.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Body { get; set; }
|
public string? Body { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the body (as JSON object).
|
/// Gets or sets the body (as JSON object).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object BodyAsJson { get; set; }
|
public object? BodyAsJson { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use ResponseMessage Transformer.
|
/// Use ResponseMessage Transformer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? UseTransformer { get; set; }
|
public bool? UseTransformer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the type of the transformer.
|
/// Gets the type of the transformer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TransformerType { get; set; }
|
public string? TransformerType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The ReplaceNodeOptions to use when transforming a JSON node.
|
/// The ReplaceNodeOptions to use when transforming a JSON node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TransformerReplaceNodeOptions { get; set; }
|
public string? TransformerReplaceNodeOptions { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the delay in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
public int? Delay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the minimum random delay in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
public int? MinimumRandomDelay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the maximum random delay in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
public int? MaximumRandomDelay { get; set; }
|
||||||
}
|
}
|
||||||
@@ -30,12 +30,12 @@ public class LogEntryModel
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mapping unique title.
|
/// The mapping unique title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MappingTitle { get; set; }
|
public string? MappingTitle { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The request match result.
|
/// The request match result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LogRequestMatchModel RequestMatchResult { get; set; }
|
public LogRequestMatchModel? RequestMatchResult { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The partial mapping unique identifier.
|
/// The partial mapping unique identifier.
|
||||||
@@ -45,10 +45,10 @@ public class LogEntryModel
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The partial mapping unique title.
|
/// The partial mapping unique title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PartialMappingTitle { get; set; }
|
public string? PartialMappingTitle { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The partial request match result.
|
/// The partial request match result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LogRequestMatchModel PartialRequestMatchResult { get; set; }
|
public LogRequestMatchModel? PartialRequestMatchResult { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,58 +1,71 @@
|
|||||||
namespace WireMock.Admin.Settings
|
namespace WireMock.Admin.Settings;
|
||||||
|
|
||||||
|
[FluentBuilder.AutoGenerateBuilder]
|
||||||
|
public class ProxyAndRecordSettingsModel
|
||||||
{
|
{
|
||||||
[FluentBuilder.AutoGenerateBuilder]
|
/// <summary>
|
||||||
public class ProxyAndRecordSettingsModel
|
/// The clientCertificate thumbprint or subject name fragment to use.
|
||||||
{
|
/// Example thumbprint : "D2DBF135A8D06ACCD0E1FAD9BFB28678DF7A9818". Example subject name: "www.google.com""
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// The clientCertificate thumbprint or subject name fragment to use.
|
public string ClientX509Certificate2ThumbprintOrSubjectName { get; set; }
|
||||||
/// Example thumbprint : "D2DBF135A8D06ACCD0E1FAD9BFB28678DF7A9818". Example subject name: "www.google.com""
|
|
||||||
/// </summary>
|
|
||||||
public string ClientX509Certificate2ThumbprintOrSubjectName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the WebProxySettings.
|
/// Defines the WebProxySettings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WebProxySettingsModel WebProxySettings { get; set; }
|
public WebProxySettingsModel WebProxySettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Proxy requests should follow redirection (30x).
|
/// Proxy requests should follow redirection (30x).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? AllowAutoRedirect { get; set; }
|
public bool? AllowAutoRedirect { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The URL to proxy.
|
/// The URL to proxy.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save the mapping for each request/response to the internal Mappings.
|
/// Save the mapping for each request/response to the internal Mappings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SaveMapping { get; set; }
|
public bool SaveMapping { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save the mapping for each request/response also to a file. (Note that SaveMapping must also be set to true.)
|
/// Save the mapping for each request/response also to a file. (Note that SaveMapping must also be set to true.)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SaveMappingToFile { get; set; }
|
public bool SaveMappingToFile { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Only save request/response to the internal Mappings if the status code is included in this pattern. (Note that SaveMapping must also be set to true.)
|
/// Only save request/response to the internal Mappings if the status code is included in this pattern. (Note that SaveMapping must also be set to true.)
|
||||||
/// The pattern can contain a single value like "200", but also ranges like "2xx", "100,300,600" or "100-299,6xx" are supported.
|
/// The pattern can contain a single value like "200", but also ranges like "2xx", "100,300,600" or "100-299,6xx" are supported.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SaveMappingForStatusCodePattern { get; set; } = "*";
|
public string SaveMappingForStatusCodePattern { get; set; } = "*";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines a list from headers which will be excluded from the saved mappings.
|
/// Defines a list from headers which will be excluded from the saved mappings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] ExcludedHeaders { get; set; }
|
public string[] ExcludedHeaders { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines a list of cookies which will be excluded from the saved mappings.
|
/// Defines a list of cookies which will be excluded from the saved mappings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] ExcludedCookies { get; set; }
|
public string[] ExcludedCookies { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prefer the Proxy Mapping over the saved Mapping (in case SaveMapping is set to <c>true</c>).
|
/// Prefer the Proxy Mapping over the saved Mapping (in case SaveMapping is set to <c>true</c>).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// public bool PreferProxyMapping { get; set; }
|
// public bool PreferProxyMapping { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// When SaveMapping is set to <c>true</c>, this setting can be used to control the behavior of the generated request matchers for the new mapping.
|
||||||
|
/// - <c>false</c>, the default matchers will be used.
|
||||||
|
/// - <c>true</c>, the defined mappings in the request wil be used for the new mapping.
|
||||||
|
///
|
||||||
|
/// Default value is false.
|
||||||
|
/// </summary>
|
||||||
|
public bool UseDefinedRequestMatchers { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Append an unique GUID to the filename from the saved mapping file.
|
||||||
|
/// </summary>
|
||||||
|
public bool AppendGuidToSavedMappingFile { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,82 +1,99 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using WireMock.Handlers;
|
using WireMock.Handlers;
|
||||||
|
using WireMock.Types;
|
||||||
|
|
||||||
namespace WireMock.Admin.Settings
|
namespace WireMock.Admin.Settings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Settings
|
||||||
|
/// </summary>
|
||||||
|
[FluentBuilder.AutoGenerateBuilder]
|
||||||
|
public class SettingsModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Settings
|
/// Gets or sets the global delay in milliseconds.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[FluentBuilder.AutoGenerateBuilder]
|
public int? GlobalProcessingDelay { get; set; }
|
||||||
public class SettingsModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the global delay in milliseconds.
|
|
||||||
/// </summary>
|
|
||||||
public int? GlobalProcessingDelay { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets if partial mapping is allowed.
|
/// Gets or sets if partial mapping is allowed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? AllowPartialMapping { get; set; }
|
public bool? AllowPartialMapping { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the RequestLog expiration in hours
|
/// Gets or sets the RequestLog expiration in hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? RequestLogExpirationDuration { get; set; }
|
public int? RequestLogExpirationDuration { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the MaxRequestLog count.
|
/// Gets or sets the MaxRequestLog count.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? MaxRequestLogCount { get; set; }
|
public int? MaxRequestLogCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allow a Body for all HTTP Methods. (default set to false).
|
/// Allow a Body for all HTTP Methods. (default set to false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? AllowBodyForAllHttpMethods { get; set; }
|
public bool? AllowBodyForAllHttpMethods { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle all requests synchronously. (default set to false).
|
/// Handle all requests synchronously. (default set to false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? HandleRequestsSynchronously { get; set; }
|
public bool? HandleRequestsSynchronously { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Throw an exception when the Matcher fails because of invalid input. (default set to false).
|
/// Throw an exception when the Matcher fails because of invalid input. (default set to false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? ThrowExceptionWhenMatcherFails { get; set; }
|
public bool? ThrowExceptionWhenMatcherFails { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use the RegexExtended instead of the default <see cref="Regex"/>. (default set to true).
|
/// Use the RegexExtended instead of the default <see cref="Regex"/>. (default set to true).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? UseRegexExtended { get; set; }
|
public bool? UseRegexExtended { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save unmatched requests to a file using the <see cref="IFileSystemHandler"/>. (default set to false).
|
/// Save unmatched requests to a file using the <see cref="IFileSystemHandler"/>. (default set to false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? SaveUnmatchedRequests { get; set; }
|
public bool? SaveUnmatchedRequests { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets if the static mappings should be read at startup.
|
/// Gets or sets if the static mappings should be read at startup.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? ReadStaticMappings { get; set; }
|
public bool? ReadStaticMappings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Watch the static mapping files + folder for changes when running.
|
/// Watch the static mapping files + folder for changes when running.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? WatchStaticMappings { get; set; }
|
public bool? WatchStaticMappings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A value indicating whether subdirectories within the static mappings path should be monitored.
|
/// A value indicating whether subdirectories within the static mappings path should be monitored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? WatchStaticMappingsInSubdirectories { get; set; }
|
public bool? WatchStaticMappingsInSubdirectories { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Policies to use when using CORS. By default CORS is disabled. [Optional]
|
/// Policies to use when using CORS. By default CORS is disabled. [Optional]
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? CorsPolicyOptions { get; set; }
|
public string? CorsPolicyOptions { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The proxy and record settings.
|
/// The proxy and record settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ProxyAndRecordSettingsModel? ProxyAndRecordSettings { get; set; }
|
public ProxyAndRecordSettingsModel? ProxyAndRecordSettings { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines on which scheme (http/https) to host. (This overrides the <c>UseSSL</c> value).
|
||||||
|
/// </summary>
|
||||||
|
public HostingScheme? HostingScheme { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Don't save the response-string in the LogEntry when WithBody(Func{IRequestMessage, string}) or WithBody(Func{IRequestMessage, Task{string}}) is used. (default set to false).
|
||||||
|
/// </summary>
|
||||||
|
public bool? DoNotSaveDynamicResponseInLogEntry { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// See <seealso cref="QueryParameterMultipleValueSupport"/>.
|
||||||
|
///
|
||||||
|
/// Default value = "All".
|
||||||
|
/// </summary>
|
||||||
|
public QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; }
|
||||||
}
|
}
|
||||||
17
src/WireMock.Net.Abstractions/Constants/HttpRequestMethod.cs
Normal file
17
src/WireMock.Net.Abstractions/Constants/HttpRequestMethod.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace WireMock.Constants;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
|
||||||
|
/// </summary>
|
||||||
|
public static class HttpRequestMethod
|
||||||
|
{
|
||||||
|
public const string CONNECT = "CONNECT";
|
||||||
|
public const string DELETE = "DELETE";
|
||||||
|
public const string GET = "GET";
|
||||||
|
public const string HEAD = "HEAD";
|
||||||
|
public const string OPTIONS = "OPTIONS";
|
||||||
|
public const string PATCH = "PATCH";
|
||||||
|
public const string POST = "POST";
|
||||||
|
public const string PUT = "PUT";
|
||||||
|
public const string TRACE = "TRACE";
|
||||||
|
}
|
||||||
@@ -28,7 +28,7 @@ public interface IRequestMessage
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The ProxyUrl (if a proxy is used).
|
/// The ProxyUrl (if a proxy is used).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string ProxyUrl { get; set; }
|
string? ProxyUrl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the DateTime.
|
/// Gets the DateTime.
|
||||||
|
|||||||
@@ -3,60 +3,59 @@ using WireMock.ResponseBuilders;
|
|||||||
using WireMock.Types;
|
using WireMock.Types;
|
||||||
using WireMock.Util;
|
using WireMock.Util;
|
||||||
|
|
||||||
namespace WireMock
|
namespace WireMock;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IResponseMessage
|
||||||
|
/// </summary>
|
||||||
|
public interface IResponseMessage
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IResponseMessage
|
/// The Body.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IResponseMessage
|
IBodyData? BodyData { get; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The Body.
|
|
||||||
/// </summary>
|
|
||||||
IBodyData? BodyData { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the body destination (SameAsSource, String or Bytes).
|
/// Gets the body destination (Null, SameAsSource, String or Bytes).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string BodyDestination { get; }
|
string? BodyDestination { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the body.
|
/// Gets or sets the body.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string BodyOriginal { get; }
|
string? BodyOriginal { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the Fault percentage.
|
/// Gets the Fault percentage.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
double? FaultPercentage { get; }
|
double? FaultPercentage { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The FaultType.
|
/// The FaultType.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
FaultType FaultType { get; }
|
FaultType FaultType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the headers.
|
/// Gets the headers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IDictionary<string, WireMockList<string>>? Headers { get; }
|
IDictionary<string, WireMockList<string>>? Headers { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the status code.
|
/// Gets or sets the status code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
object StatusCode { get; }
|
object? StatusCode { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the header.
|
/// Adds the header.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="value">The value.</param>
|
/// <param name="value">The value.</param>
|
||||||
void AddHeader(string name, string value);
|
void AddHeader(string name, string value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the header.
|
/// Adds the header.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="values">The values.</param>
|
/// <param name="values">The values.</param>
|
||||||
void AddHeader(string name, params string[] values);
|
void AddHeader(string name, params string[] values);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,56 +1,55 @@
|
|||||||
using System;
|
using System;
|
||||||
using WireMock.Matchers.Request;
|
using WireMock.Matchers.Request;
|
||||||
|
|
||||||
namespace WireMock.Logging
|
namespace WireMock.Logging;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ILogEntry
|
||||||
|
/// </summary>
|
||||||
|
public interface ILogEntry
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ILogEntry
|
/// Gets the unique identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ILogEntry
|
Guid Guid { get; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the unique identifier.
|
|
||||||
/// </summary>
|
|
||||||
Guid Guid { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the mapping unique identifier.
|
/// Gets the mapping unique identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Guid? MappingGuid { get; }
|
Guid? MappingGuid { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the mapping unique title.
|
/// Gets the mapping unique title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string MappingTitle { get; }
|
string? MappingTitle { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the partial mapping unique identifier.
|
/// Gets the partial mapping unique identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Guid? PartialMappingGuid { get; }
|
Guid? PartialMappingGuid { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the partial mapping unique title.
|
/// Gets the partial mapping unique title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string PartialMappingTitle { get; }
|
string? PartialMappingTitle { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the partial match result.
|
/// Gets the partial match result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IRequestMatchResult PartialMatchResult { get; }
|
IRequestMatchResult PartialMatchResult { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the request match result.
|
/// Gets the request match result.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IRequestMatchResult RequestMatchResult { get; }
|
IRequestMatchResult RequestMatchResult { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the request message.
|
/// Gets the request message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IRequestMessage RequestMessage { get; }
|
IRequestMessage RequestMessage { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the response message.
|
/// Gets the response message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IResponseMessage ResponseMessage { get; }
|
IResponseMessage ResponseMessage { get; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,17 @@
|
|||||||
using JetBrains.Annotations;
|
namespace WireMock.Matchers.Request;
|
||||||
|
|
||||||
namespace WireMock.Matchers.Request
|
/// <summary>
|
||||||
|
/// The RequestMatcher interface.
|
||||||
|
/// </summary>
|
||||||
|
public interface IRequestMatcher
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The RequestMatcher interface.
|
/// Determines whether the specified RequestMessage is match.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRequestMatcher
|
/// <param name="requestMessage">The RequestMessage.</param>
|
||||||
{
|
/// <param name="requestMatchResult">The RequestMatchResult.</param>
|
||||||
/// <summary>
|
/// <returns>
|
||||||
/// Determines whether the specified RequestMessage is match.
|
/// A value between 0.0 - 1.0 of the similarity.
|
||||||
/// </summary>
|
/// </returns>
|
||||||
/// <param name="requestMessage">The RequestMessage.</param>
|
double GetMatchingScore(IRequestMessage requestMessage, IRequestMatchResult requestMatchResult);
|
||||||
/// <param name="requestMatchResult">The RequestMatchResult.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// A value between 0.0 - 1.0 of the similarity.
|
|
||||||
/// </returns>
|
|
||||||
double GetMatchingScore(IRequestMessage requestMessage, IRequestMatchResult requestMatchResult);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using WireMock.Types;
|
using WireMock.Types;
|
||||||
|
|
||||||
namespace WireMock.Util;
|
namespace WireMock.Util;
|
||||||
@@ -13,12 +11,12 @@ public interface IBodyData
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The body (as bytearray).
|
/// The body (as bytearray).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
byte[] BodyAsBytes { get; set; }
|
byte[]? BodyAsBytes { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the body as a file.
|
/// Gets or sets the body as a file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string BodyAsFile { get; set; }
|
string? BodyAsFile { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is the body as file cached?
|
/// Is the body as file cached?
|
||||||
@@ -38,7 +36,7 @@ public interface IBodyData
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The body as string, this is defined when BodyAsString or BodyAsJson are not null.
|
/// The body as string, this is defined when BodyAsString or BodyAsJson are not null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string BodyAsString { get; set; }
|
string? BodyAsString { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The detected body type (detection based on body content).
|
/// The detected body type (detection based on body content).
|
||||||
@@ -59,4 +57,9 @@ public interface IBodyData
|
|||||||
/// The body encoding.
|
/// The body encoding.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Encoding? Encoding { get; set; }
|
Encoding? Encoding { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines if this BodyData is the result of a dynamically created response-string. (
|
||||||
|
/// </summary>
|
||||||
|
public string? IsFuncUsed { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,24 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace WireMock.Models
|
namespace WireMock.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// TimeSettings: Start, End and TTL
|
||||||
|
/// </summary>
|
||||||
|
public interface ITimeSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TimeSettings: Start, End and TTL
|
/// Gets or sets the DateTime from which this mapping should be used. In case this is not defined, it's used (default behavior).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ITimeSettings
|
DateTime? Start { get; set; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the DateTime from which this mapping should be used. In case this is not defined, it's used (default behavior).
|
|
||||||
/// </summary>
|
|
||||||
DateTime? Start { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the DateTime from until this mapping should be used. In case this is not defined, it's used forever (default behavior).
|
/// Gets or sets the DateTime from until this mapping should be used. In case this is not defined, it's used forever (default behavior).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DateTime? End { get; set; }
|
DateTime? End { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the TTL (Time To Live) in seconds for this mapping. In case this is not defined, it's used (default behavior).
|
/// Gets or sets the TTL (Time To Live) in seconds for this mapping. In case this is not defined, it's used (default behavior).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int? TTL { get; set; }
|
int? TTL { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
namespace WireMock.Models
|
namespace WireMock.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IWebhook
|
||||||
|
/// </summary>
|
||||||
|
public interface IWebhook
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IWebhook
|
/// Request
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWebhook
|
IWebhookRequest Request { get; set; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Request
|
|
||||||
/// </summary>
|
|
||||||
IWebhookRequest Request { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -2,46 +2,60 @@ using System.Collections.Generic;
|
|||||||
using WireMock.Types;
|
using WireMock.Types;
|
||||||
using WireMock.Util;
|
using WireMock.Util;
|
||||||
|
|
||||||
namespace WireMock.Models
|
namespace WireMock.Models;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IWebhookRequest
|
||||||
|
/// </summary>
|
||||||
|
public interface IWebhookRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IWebhookRequest
|
/// The Webhook Url.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWebhookRequest
|
string Url { get; set; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The Webhook Url.
|
|
||||||
/// </summary>
|
|
||||||
string Url { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The method to use.
|
/// The method to use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Method { get; set; }
|
string Method { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Headers to send.
|
/// The Headers to send.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IDictionary<string, WireMockList<string>>? Headers { get; }
|
IDictionary<string, WireMockList<string>>? Headers { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The body to send.
|
/// The body to send.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IBodyData? BodyData { get; set; }
|
IBodyData? BodyData { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use Transformer.
|
/// Use Transformer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool? UseTransformer { get; set; }
|
bool? UseTransformer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The transformer type.
|
/// The transformer type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TransformerType TransformerType { get; set; }
|
TransformerType TransformerType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The ReplaceNodeOptions to use when transforming a JSON node.
|
/// The ReplaceNodeOptions to use when transforming a JSON node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ReplaceNodeOptions TransformerReplaceNodeOptions { get; set; }
|
ReplaceNodeOptions TransformerReplaceNodeOptions { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the delay in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
int? Delay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the minimum random delay in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
int? MinimumRandomDelay { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the maximum random delay in milliseconds.
|
||||||
|
/// </summary>
|
||||||
|
int? MaximumRandomDelay { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using WireMock.Admin.Mappings;
|
using WireMock.Admin.Mappings;
|
||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
using WireMock.Matchers.Request;
|
|
||||||
|
|
||||||
namespace WireMock.Server
|
namespace WireMock.Server
|
||||||
{
|
{
|
||||||
@@ -144,6 +142,11 @@ namespace WireMock.Server
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void ResetScenarios();
|
void ResetScenarios();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets a specific Scenario by the name.
|
||||||
|
/// </summary>
|
||||||
|
bool ResetScenario(string name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets the LogEntries.
|
/// Resets the LogEntries.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
15
src/WireMock.Net.Abstractions/Types/HostingScheme.cs
Normal file
15
src/WireMock.Net.Abstractions/Types/HostingScheme.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace WireMock.Types;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum HostingScheme
|
||||||
|
{
|
||||||
|
None = 0x0,
|
||||||
|
|
||||||
|
Http = 0x1,
|
||||||
|
|
||||||
|
Https = 0x2,
|
||||||
|
|
||||||
|
HttpAndHttps = Http | Https
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace WireMock.Types;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum QueryParameterMultipleValueSupport
|
||||||
|
{
|
||||||
|
// Support none
|
||||||
|
None = 0x0,
|
||||||
|
|
||||||
|
// Support "&" as multi-value-separator --> "key=value&key=anotherValue"
|
||||||
|
Ampersand = 0x1,
|
||||||
|
|
||||||
|
// Support ";" as multi-value-separator --> "key=value;key=anotherValue"
|
||||||
|
SemiColon = 0x2,
|
||||||
|
|
||||||
|
// Support "," as multi-value-separator --> "key=1,2"
|
||||||
|
Comma = 0x4,
|
||||||
|
|
||||||
|
// Support "&" and ";" as multi-value-separator --> "key=value&key=anotherValue" and also "key=value;key=anotherValue"
|
||||||
|
AmpersandAndSemiColon = Ampersand | SemiColon,
|
||||||
|
|
||||||
|
// Support "&" and ";" as multi-value-separator
|
||||||
|
NoComma = AmpersandAndSemiColon,
|
||||||
|
|
||||||
|
// Support all multi-value-separators ("&" and ";" and ",")
|
||||||
|
All = Ampersand | SemiColon | Comma
|
||||||
|
}
|
||||||
@@ -1,44 +1,69 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace WireMock.Types
|
namespace WireMock.Types;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A special List which overrides the ToString() to return first value.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The generic type</typeparam>
|
||||||
|
/// <seealso cref="List{T}" />
|
||||||
|
public class WireMockList<T> : List<T>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A special List which overrides the ToString() to return first value.
|
/// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The generic type</typeparam>
|
public WireMockList()
|
||||||
/// <seealso cref="List{T}" />
|
|
||||||
public class WireMockList<T> : List<T>
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
}
|
||||||
/// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
|
|
||||||
/// </summary>
|
|
||||||
public WireMockList()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
|
/// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="collection">The collection whose elements are copied to the new list.</param>
|
/// <param name="collection">The collection whose elements are copied to the new list.</param>
|
||||||
public WireMockList(params T[] collection) : base(collection)
|
public WireMockList(params T[] collection) : base(collection)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
|
/// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="collection">The collection whose elements are copied to the new list.</param>
|
/// <param name="collection">The collection whose elements are copied to the new list.</param>
|
||||||
public WireMockList(IEnumerable<T> collection) : base(collection)
|
public WireMockList(IEnumerable<T> collection) : base(collection)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="string" /> that represents this instance.
|
/// Operator for setting T
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override string ToString()
|
/// <param name="value">The value to set.</param>
|
||||||
|
public static implicit operator WireMockList<T>(T value) => new(value);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Operator for setting T[]
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="values">The values to set.</param>
|
||||||
|
public static implicit operator WireMockList<T>(T[] values) => new(values);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a <see cref="string" /> that represents this instance.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
switch (Count)
|
||||||
{
|
{
|
||||||
return this.Any() ? this.First().ToString() : base.ToString();
|
case 0:
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
if (this[0] is string strValue)
|
||||||
|
{
|
||||||
|
return strValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this[0]?.ToString();
|
||||||
|
|
||||||
|
default:
|
||||||
|
return base.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
|
||||||
|
|
||||||
<!-- See also https://mstack.nl/blog/20210801-source-generators -->
|
<!-- See also https://mstack.nl/blog/20210801-source-generators -->
|
||||||
<PackageReference Include="FluentBuilder" Version="0.4.4">
|
<PackageReference Include="FluentBuilder" Version="0.5.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -1,97 +1,138 @@
|
|||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using FluentAssertions.Execution;
|
using FluentAssertions.Execution;
|
||||||
|
using WireMock.Constants;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
|
using WireMock.Types;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace WireMock.FluentAssertions;
|
namespace WireMock.FluentAssertions;
|
||||||
|
|
||||||
public class WireMockAssertions
|
public class WireMockAssertions
|
||||||
{
|
{
|
||||||
private readonly IWireMockServer _subject;
|
private const string Any = "*";
|
||||||
private readonly int? _callsCount;
|
private readonly int? _callsCount;
|
||||||
|
private IReadOnlyList<IRequestMessage> _requestMessages;
|
||||||
|
private readonly IReadOnlyList<KeyValuePair<string, WireMockList<string>>> _headers;
|
||||||
|
|
||||||
public WireMockAssertions(IWireMockServer subject, int? callsCount)
|
public WireMockAssertions(IWireMockServer subject, int? callsCount)
|
||||||
{
|
{
|
||||||
_subject = subject;
|
|
||||||
_callsCount = callsCount;
|
_callsCount = callsCount;
|
||||||
|
_requestMessages = subject.LogEntries.Select(logEntry => logEntry.RequestMessage).ToList();
|
||||||
|
_headers = _requestMessages.SelectMany(req => req.Headers).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> AtAbsoluteUrl(string absoluteUrl, string because = "", params object[] becauseArgs)
|
public AndWhichConstraint<WireMockAssertions, string> AtAbsoluteUrl(string absoluteUrl, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
|
Func<IRequestMessage, bool> predicate = request => string.Equals(request.AbsoluteUrl, absoluteUrl, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var (filter, condition) = BuildFilterAndCondition(predicate);
|
||||||
|
|
||||||
Execute.Assertion
|
Execute.Assertion
|
||||||
.BecauseOf(because, becauseArgs)
|
.BecauseOf(because, becauseArgs)
|
||||||
.Given(() => _subject.LogEntries.Select(x => x.RequestMessage).ToList())
|
.Given(() => _requestMessages)
|
||||||
.ForCondition(requests => requests.Any())
|
.ForCondition(requests => _callsCount == 0 || requests.Any())
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called at address matching the absolute url {0}{reason}, but no calls were made.",
|
"Expected {context:wiremockserver} to have been called at address matching the absolute url {0}{reason}, but no calls were made.",
|
||||||
absoluteUrl)
|
absoluteUrl
|
||||||
|
)
|
||||||
.Then
|
.Then
|
||||||
.ForCondition(x => _callsCount == null && x.Any(y => y.AbsoluteUrl == absoluteUrl) || _callsCount == x.Count(y => y.AbsoluteUrl == absoluteUrl))
|
.ForCondition(condition)
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called at address matching the absolute url {0}{reason}, but didn't find it among the calls to {1}.",
|
"Expected {context:wiremockserver} to have been called at address matching the absolute url {0}{reason}, but didn't find it among the calls to {1}.",
|
||||||
_ => absoluteUrl, requests => requests.Select(request => request.AbsoluteUrl));
|
_ => absoluteUrl, requests => requests.Select(request => request.AbsoluteUrl)
|
||||||
|
);
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
_requestMessages = filter(_requestMessages).ToList();
|
||||||
|
|
||||||
|
return new AndWhichConstraint<WireMockAssertions, string>(this, absoluteUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> AtUrl(string url, string because = "", params object[] becauseArgs)
|
public AndWhichConstraint<WireMockAssertions, string> AtUrl(string url, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
|
Func<IRequestMessage, bool> predicate = request => string.Equals(request.Url, url, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var (filter, condition) = BuildFilterAndCondition(predicate);
|
||||||
|
|
||||||
Execute.Assertion
|
Execute.Assertion
|
||||||
.BecauseOf(because, becauseArgs)
|
.BecauseOf(because, becauseArgs)
|
||||||
.Given(() => _subject.LogEntries.Select(x => x.RequestMessage).ToList())
|
.Given(() => _requestMessages)
|
||||||
.ForCondition(requests => requests.Any())
|
.ForCondition(requests => _callsCount == 0 || requests.Any())
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but no calls were made.",
|
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but no calls were made.",
|
||||||
url)
|
url
|
||||||
|
)
|
||||||
.Then
|
.Then
|
||||||
.ForCondition(x => _callsCount == null && x.Any(y => y.Url == url) || _callsCount == x.Count(y => y.Url == url))
|
.ForCondition(condition)
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but didn't find it among the calls to {1}.",
|
"Expected {context:wiremockserver} to have been called at address matching the url {0}{reason}, but didn't find it among the calls to {1}.",
|
||||||
_ => url, requests => requests.Select(request => request.Url));
|
_ => url,
|
||||||
|
requests => requests.Select(request => request.Url)
|
||||||
|
);
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
_requestMessages = filter(_requestMessages).ToList();
|
||||||
|
|
||||||
|
return new AndWhichConstraint<WireMockAssertions, string>(this, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> WithProxyUrl(string proxyUrl, string because = "", params object[] becauseArgs)
|
public AndWhichConstraint<WireMockAssertions, string> WithProxyUrl(string proxyUrl, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
|
Func<IRequestMessage, bool> predicate = request => string.Equals(request.ProxyUrl, proxyUrl, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var (filter, condition) = BuildFilterAndCondition(predicate);
|
||||||
|
|
||||||
Execute.Assertion
|
Execute.Assertion
|
||||||
.BecauseOf(because, becauseArgs)
|
.BecauseOf(because, becauseArgs)
|
||||||
.Given(() => _subject.LogEntries.Select(x => x.RequestMessage).ToList())
|
.Given(() => _requestMessages)
|
||||||
.ForCondition(requests => requests.Any())
|
.ForCondition(requests => _callsCount == 0 || requests.Any())
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but no calls were made.",
|
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but no calls were made.",
|
||||||
proxyUrl)
|
proxyUrl
|
||||||
|
)
|
||||||
.Then
|
.Then
|
||||||
.ForCondition(x => _callsCount == null && x.Any(y => y.ProxyUrl == proxyUrl) || _callsCount == x.Count(y => y.ProxyUrl == proxyUrl))
|
.ForCondition(condition)
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but didn't find it among the calls with {1}.",
|
"Expected {context:wiremockserver} to have been called with proxy url {0}{reason}, but didn't find it among the calls with {1}.",
|
||||||
_ => proxyUrl, requests => requests.Select(request => request.ProxyUrl));
|
_ => proxyUrl,
|
||||||
|
requests => requests.Select(request => request.ProxyUrl)
|
||||||
|
);
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
_requestMessages = filter(_requestMessages).ToList();
|
||||||
|
|
||||||
|
return new AndWhichConstraint<WireMockAssertions, string>(this, proxyUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> FromClientIP(string clientIP, string because = "", params object[] becauseArgs)
|
public AndWhichConstraint<WireMockAssertions, string> FromClientIP(string clientIP, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
|
Func<IRequestMessage, bool> predicate = request => string.Equals(request.ClientIP, clientIP, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var (filter, condition) = BuildFilterAndCondition(predicate);
|
||||||
|
|
||||||
Execute.Assertion
|
Execute.Assertion
|
||||||
.BecauseOf(because, becauseArgs)
|
.BecauseOf(because, becauseArgs)
|
||||||
.Given(() => _subject.LogEntries.Select(x => x.RequestMessage).ToList())
|
.Given(() => _requestMessages)
|
||||||
.ForCondition(requests => requests.Any())
|
.ForCondition(requests => _callsCount == 0 || requests.Any())
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but no calls were made.",
|
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but no calls were made.",
|
||||||
clientIP)
|
clientIP
|
||||||
|
)
|
||||||
.Then
|
.Then
|
||||||
.ForCondition(x => _callsCount == null && x.Any(y => y.ClientIP == clientIP) || _callsCount == x.Count(y => y.ClientIP == clientIP))
|
.ForCondition(condition)
|
||||||
.FailWith(
|
.FailWith(
|
||||||
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but didn't find it among the calls from IP(s) {1}.",
|
"Expected {context:wiremockserver} to have been called from client IP {0}{reason}, but didn't find it among the calls from IP(s) {1}.",
|
||||||
_ => clientIP, requests => requests.Select(request => request.ClientIP));
|
_ => clientIP, requests => requests.Select(request => request.ClientIP)
|
||||||
|
);
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
_requestMessages = filter(_requestMessages).ToList();
|
||||||
|
|
||||||
|
return new AndWhichConstraint<WireMockAssertions, string>(this, clientIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
@@ -101,32 +142,106 @@ public class WireMockAssertions
|
|||||||
[CustomAssertion]
|
[CustomAssertion]
|
||||||
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
public AndConstraint<WireMockAssertions> WithHeader(string expectedKey, string[] expectedValues, string because = "", params object[] becauseArgs)
|
||||||
{
|
{
|
||||||
var headersDictionary = _subject.LogEntries.SelectMany(x => x.RequestMessage.Headers)
|
|
||||||
.ToDictionary(x => x.Key, x => x.Value);
|
|
||||||
|
|
||||||
using (new AssertionScope("headers from requests sent"))
|
using (new AssertionScope("headers from requests sent"))
|
||||||
{
|
{
|
||||||
headersDictionary.Should().ContainKey(expectedKey, because, becauseArgs);
|
_headers.Select(h => h.Key).Should().Contain(expectedKey, because, becauseArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
using (new AssertionScope($"header \"{expectedKey}\" from requests sent with value(s)"))
|
using (new AssertionScope($"header \"{expectedKey}\" from requests sent with value(s)"))
|
||||||
{
|
{
|
||||||
|
var headerValues = _headers.First(h => h.Key == expectedKey).Value;
|
||||||
|
|
||||||
if (expectedValues.Length == 1)
|
if (expectedValues.Length == 1)
|
||||||
{
|
{
|
||||||
headersDictionary[expectedKey].Should().Contain(expectedValues.First());
|
headerValues.Should().Contain(expectedValues.First(), because, becauseArgs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var trimmedHeaderValues = string.Join(",", headersDictionary[expectedKey].Select(x => x)).Split(',')
|
var trimmedHeaderValues = string.Join(",", headerValues.Select(x => x)).Split(',').Select(x => x.Trim()).ToList();
|
||||||
.Select(x => x.Trim())
|
|
||||||
.ToList();
|
|
||||||
foreach (var expectedValue in expectedValues)
|
foreach (var expectedValue in expectedValues)
|
||||||
{
|
{
|
||||||
trimmedHeaderValues.Should().Contain(expectedValue);
|
trimmedHeaderValues.Should().Contain(expectedValue, because, becauseArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AndConstraint<WireMockAssertions>(this);
|
return new AndConstraint<WireMockAssertions>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingConnect(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.CONNECT, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingDelete(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.DELETE, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingGet(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.GET, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingHead(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.HEAD, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingOptions(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.OPTIONS, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingPost(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.POST, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingPatch(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.PATCH, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingPut(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.PUT, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingTrace(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(HttpRequestMethod.TRACE, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingAnyMethod(string because = "", params object[] becauseArgs)
|
||||||
|
=> UsingMethod(Any, because, becauseArgs);
|
||||||
|
|
||||||
|
[CustomAssertion]
|
||||||
|
public AndConstraint<WireMockAssertions> UsingMethod(string method, string because = "", params object[] becauseArgs)
|
||||||
|
{
|
||||||
|
var any = method == Any;
|
||||||
|
Func<IRequestMessage, bool> predicate = request => (any && !string.IsNullOrEmpty(request.Method)) ||
|
||||||
|
string.Equals(request.Method, method, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var (filter, condition) = BuildFilterAndCondition(predicate);
|
||||||
|
|
||||||
|
Execute.Assertion
|
||||||
|
.BecauseOf(because, becauseArgs)
|
||||||
|
.Given(() => _requestMessages)
|
||||||
|
.ForCondition(requests => _callsCount == 0 || requests.Any())
|
||||||
|
.FailWith(
|
||||||
|
"Expected {context:wiremockserver} to have been called using method {0}{reason}, but no calls were made.",
|
||||||
|
method
|
||||||
|
)
|
||||||
|
.Then
|
||||||
|
.ForCondition(condition)
|
||||||
|
.FailWith(
|
||||||
|
"Expected {context:wiremockserver} to have been called using method {0}{reason}, but didn't find it among the methods {1}.",
|
||||||
|
_ => method,
|
||||||
|
requests => requests.Select(request => request.Method)
|
||||||
|
);
|
||||||
|
|
||||||
|
_requestMessages = filter(_requestMessages).ToList();
|
||||||
|
|
||||||
|
return new AndConstraint<WireMockAssertions>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private (Func<IReadOnlyList<IRequestMessage>, IReadOnlyList<IRequestMessage>> Filter, Func<IReadOnlyList<IRequestMessage>, bool> Condition) BuildFilterAndCondition(Func<IRequestMessage, bool> predicate)
|
||||||
|
{
|
||||||
|
Func<IReadOnlyList<IRequestMessage>, IReadOnlyList<IRequestMessage>> filter = requests => requests.Where(predicate).ToList();
|
||||||
|
|
||||||
|
return (filter, requests => (_callsCount is null && filter(requests).Any()) || _callsCount == filter(requests).Count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
<!--<DelaySign>true</DelaySign>-->
|
<!--<DelaySign>true</DelaySign>-->
|
||||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
|
<LangVersion>10</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ internal class CSharpCodeMatcher : ICSharpCodeMatcher
|
|||||||
MatchOperator = matchOperator;
|
MatchOperator = matchOperator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double IsMatch(string input)
|
public double IsMatch(string? input)
|
||||||
{
|
{
|
||||||
return IsMatchInternal(input);
|
return IsMatchInternal(input);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
#if NET46 || NETSTANDARD2_0
|
#if NET46 || NETSTANDARD2_0
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Extensions
|
namespace WireMock.Net.OpenApiParser.Extensions;
|
||||||
|
|
||||||
|
internal static class DictionaryExtensions
|
||||||
{
|
{
|
||||||
internal static class DictionaryExtensions
|
public static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue>? dictionary, TKey key, TValue value)
|
||||||
{
|
{
|
||||||
public static bool TryAdd<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
|
if (dictionary is null || dictionary.ContainsKey(key))
|
||||||
{
|
{
|
||||||
if (dictionary is null || dictionary.ContainsKey(key))
|
return false;
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
dictionary[key] = value;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dictionary[key] = value;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1,92 +1,91 @@
|
|||||||
using Microsoft.OpenApi.Any;
|
using Microsoft.OpenApi.Any;
|
||||||
using Microsoft.OpenApi.Interfaces;
|
using Microsoft.OpenApi.Interfaces;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using WireMock.Net.OpenApiParser.Types;
|
using WireMock.Net.OpenApiParser.Types;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Extensions
|
namespace WireMock.Net.OpenApiParser.Extensions;
|
||||||
|
|
||||||
|
internal static class OpenApiSchemaExtensions
|
||||||
{
|
{
|
||||||
internal static class OpenApiSchemaExtensions
|
/// <summary>
|
||||||
|
/// https://stackoverflow.com/questions/48111459/how-to-define-a-property-that-can-be-string-or-null-in-openapi-swagger
|
||||||
|
/// </summary>
|
||||||
|
public static bool TryGetXNullable(this OpenApiSchema schema, out bool value)
|
||||||
{
|
{
|
||||||
/// <summary>
|
value = false;
|
||||||
/// https://stackoverflow.com/questions/48111459/how-to-define-a-property-that-can-be-string-or-null-in-openapi-swagger
|
|
||||||
/// </summary>
|
if (schema.Extensions.TryGetValue("x-nullable", out IOpenApiExtension e) && e is OpenApiBoolean openApiBoolean)
|
||||||
public static bool TryGetXNullable(this OpenApiSchema schema, out bool value)
|
|
||||||
{
|
{
|
||||||
value = false;
|
value = openApiBoolean.Value;
|
||||||
|
return true;
|
||||||
if (schema.Extensions.TryGetValue("x-nullable", out IOpenApiExtension e) && e is OpenApiBoolean openApiBoolean)
|
|
||||||
{
|
|
||||||
value = openApiBoolean.Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SchemaType GetSchemaType(this OpenApiSchema schema)
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SchemaType GetSchemaType(this OpenApiSchema? schema)
|
||||||
|
{
|
||||||
|
switch (schema?.Type)
|
||||||
{
|
{
|
||||||
switch (schema?.Type)
|
case "object":
|
||||||
{
|
return SchemaType.Object;
|
||||||
case "object":
|
|
||||||
return SchemaType.Object;
|
|
||||||
|
|
||||||
case "array":
|
case "array":
|
||||||
return SchemaType.Array;
|
return SchemaType.Array;
|
||||||
|
|
||||||
case "integer":
|
case "integer":
|
||||||
return SchemaType.Integer;
|
return SchemaType.Integer;
|
||||||
|
|
||||||
case "number":
|
case "number":
|
||||||
return SchemaType.Number;
|
return SchemaType.Number;
|
||||||
|
|
||||||
case "boolean":
|
case "boolean":
|
||||||
return SchemaType.Boolean;
|
return SchemaType.Boolean;
|
||||||
|
|
||||||
case "string":
|
case "string":
|
||||||
return SchemaType.String;
|
return SchemaType.String;
|
||||||
|
|
||||||
case "file":
|
case "file":
|
||||||
return SchemaType.File;
|
return SchemaType.File;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return SchemaType.Unknown;
|
return SchemaType.Unknown;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static SchemaFormat GetSchemaFormat(this OpenApiSchema schema)
|
public static SchemaFormat GetSchemaFormat(this OpenApiSchema? schema)
|
||||||
|
{
|
||||||
|
switch (schema?.Format)
|
||||||
{
|
{
|
||||||
switch (schema?.Format)
|
case "float":
|
||||||
{
|
return SchemaFormat.Float;
|
||||||
case "float":
|
|
||||||
return SchemaFormat.Float;
|
|
||||||
|
|
||||||
case "double":
|
case "double":
|
||||||
return SchemaFormat.Double;
|
return SchemaFormat.Double;
|
||||||
|
|
||||||
case "int32":
|
case "int32":
|
||||||
return SchemaFormat.Int32;
|
return SchemaFormat.Int32;
|
||||||
|
|
||||||
case "int64":
|
case "int64":
|
||||||
return SchemaFormat.Int64;
|
return SchemaFormat.Int64;
|
||||||
|
|
||||||
case "date":
|
case "date":
|
||||||
return SchemaFormat.Date;
|
return SchemaFormat.Date;
|
||||||
|
|
||||||
case "date-time":
|
case "date-time":
|
||||||
return SchemaFormat.DateTime;
|
return SchemaFormat.DateTime;
|
||||||
|
|
||||||
case "password":
|
case "password":
|
||||||
return SchemaFormat.Password;
|
return SchemaFormat.Password;
|
||||||
|
|
||||||
case "byte":
|
case "byte":
|
||||||
return SchemaFormat.Byte;
|
return SchemaFormat.Byte;
|
||||||
|
|
||||||
case "binary":
|
case "binary":
|
||||||
return SchemaFormat.Binary;
|
return SchemaFormat.Binary;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return SchemaFormat.Undefined;
|
return SchemaFormat.Undefined;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,97 +1,94 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices.ComTypes;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Microsoft.OpenApi.Readers;
|
using Microsoft.OpenApi.Readers;
|
||||||
using SharpYaml.Model;
|
|
||||||
using Stef.Validation;
|
using Stef.Validation;
|
||||||
using WireMock.Net.OpenApiParser.Settings;
|
using WireMock.Net.OpenApiParser.Settings;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Extensions
|
namespace WireMock.Net.OpenApiParser.Extensions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Some extension methods for <see cref="IWireMockServer"/>.
|
||||||
|
/// </summary>
|
||||||
|
public static class WireMockServerExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Some extension methods for <see cref="IWireMockServer"/>.
|
/// Register the mappings via an OpenAPI (swagger) V2 or V3 file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class WireMockServerExtensions
|
/// <param name="server">The WireMockServer instance</param>
|
||||||
|
/// <param name="path">Path containing OpenAPI file to parse and use the mappings.</param>
|
||||||
|
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
||||||
|
[PublicAPI]
|
||||||
|
public static IWireMockServer WithMappingFromOpenApiFile(this IWireMockServer server, string path, out OpenApiDiagnostic diagnostic)
|
||||||
{
|
{
|
||||||
/// <summary>
|
return WithMappingFromOpenApiFile(server, path, new WireMockOpenApiParserSettings(), out diagnostic);
|
||||||
/// Register the mappings via an OpenAPI (swagger) V2 or V3 file.
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="server">The WireMockServer instance</param>
|
|
||||||
/// <param name="path">Path containing OpenAPI file to parse and use the mappings.</param>
|
|
||||||
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
|
||||||
[PublicAPI]
|
|
||||||
public static IWireMockServer WithMappingFromOpenApiFile(this IWireMockServer server, string path, out OpenApiDiagnostic diagnostic)
|
|
||||||
{
|
|
||||||
return WithMappingFromOpenApiFile(server, path, null, out diagnostic);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register the mappings via an OpenAPI (swagger) V2 or V3 file.
|
/// Register the mappings via an OpenAPI (swagger) V2 or V3 file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="server">The WireMockServer instance</param>
|
/// <param name="server">The WireMockServer instance</param>
|
||||||
/// <param name="path">Path containing OpenAPI file to parse and use the mappings.</param>
|
/// <param name="path">Path containing OpenAPI file to parse and use the mappings.</param>
|
||||||
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
||||||
/// <param name="settings">Additional settings</param>
|
/// <param name="settings">Additional settings</param>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static IWireMockServer WithMappingFromOpenApiFile(this IWireMockServer server, string path, WireMockOpenApiParserSettings settings, out OpenApiDiagnostic diagnostic)
|
public static IWireMockServer WithMappingFromOpenApiFile(this IWireMockServer server, string path, WireMockOpenApiParserSettings settings, out OpenApiDiagnostic diagnostic)
|
||||||
{
|
{
|
||||||
Guard.NotNull(server, nameof(server));
|
Guard.NotNull(server, nameof(server));
|
||||||
Guard.NotNullOrEmpty(path, nameof(path));
|
Guard.NotNullOrEmpty(path, nameof(path));
|
||||||
|
|
||||||
var mappings = new WireMockOpenApiParser().FromFile(path, settings, out diagnostic);
|
var mappings = new WireMockOpenApiParser().FromFile(path, settings, out diagnostic);
|
||||||
|
|
||||||
return server.WithMapping(mappings.ToArray());
|
return server.WithMapping(mappings.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register the mappings via an OpenAPI (swagger) V2 or V3 stream.
|
/// Register the mappings via an OpenAPI (swagger) V2 or V3 stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="server">The WireMockServer instance</param>
|
/// <param name="server">The WireMockServer instance</param>
|
||||||
/// <param name="stream">Stream containing OpenAPI description to parse and use the mappings.</param>
|
/// <param name="stream">Stream containing OpenAPI description to parse and use the mappings.</param>
|
||||||
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static IWireMockServer WithMappingFromOpenApiStream(this IWireMockServer server, Stream stream, out OpenApiDiagnostic diagnostic)
|
public static IWireMockServer WithMappingFromOpenApiStream(this IWireMockServer server, Stream stream, out OpenApiDiagnostic diagnostic)
|
||||||
{
|
{
|
||||||
return WithMappingFromOpenApiStream(server, stream, null, out diagnostic);
|
return WithMappingFromOpenApiStream(server, stream, new WireMockOpenApiParserSettings(), out diagnostic);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register the mappings via an OpenAPI (swagger) V2 or V3 stream.
|
/// Register the mappings via an OpenAPI (swagger) V2 or V3 stream.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="server">The WireMockServer instance</param>
|
/// <param name="server">The WireMockServer instance</param>
|
||||||
/// <param name="stream">Stream containing OpenAPI description to parse and use the mappings.</param>
|
/// <param name="stream">Stream containing OpenAPI description to parse and use the mappings.</param>
|
||||||
/// <param name="settings">Additional settings</param>
|
/// <param name="settings">Additional settings</param>
|
||||||
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
/// <param name="diagnostic">Returns diagnostic object containing errors detected during parsing</param>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static IWireMockServer WithMappingFromOpenApiStream(this IWireMockServer server, Stream stream, WireMockOpenApiParserSettings settings, out OpenApiDiagnostic diagnostic)
|
public static IWireMockServer WithMappingFromOpenApiStream(this IWireMockServer server, Stream stream, WireMockOpenApiParserSettings settings, out OpenApiDiagnostic diagnostic)
|
||||||
{
|
{
|
||||||
Guard.NotNull(server, nameof(server));
|
Guard.NotNull(server);
|
||||||
Guard.NotNull(stream, nameof(stream));
|
Guard.NotNull(stream);
|
||||||
Guard.NotNull(settings, nameof(settings));
|
Guard.NotNull(settings);
|
||||||
|
|
||||||
var mappings = new WireMockOpenApiParser().FromStream(stream, settings, out diagnostic);
|
var mappings = new WireMockOpenApiParser().FromStream(stream, settings, out diagnostic);
|
||||||
|
|
||||||
return server.WithMapping(mappings.ToArray());
|
return server.WithMapping(mappings.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register the mappings via an OpenAPI (swagger) V2 or V3 document.
|
/// Register the mappings via an OpenAPI (swagger) V2 or V3 document.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="server">The WireMockServer instance</param>
|
/// <param name="server">The WireMockServer instance</param>
|
||||||
/// <param name="document">The OpenAPI document to use as mappings.</param>
|
/// <param name="document">The OpenAPI document to use as mappings.</param>
|
||||||
/// <param name="settings">Additional settings [optional]</param>
|
/// <param name="settings">Additional settings [optional]</param>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static IWireMockServer WithMappingFromOpenApiDocument(this IWireMockServer server, OpenApiDocument document, WireMockOpenApiParserSettings settings = null)
|
public static IWireMockServer WithMappingFromOpenApiDocument(this IWireMockServer server, OpenApiDocument document, WireMockOpenApiParserSettings settings)
|
||||||
{
|
{
|
||||||
Guard.NotNull(server, nameof(server));
|
Guard.NotNull(server);
|
||||||
Guard.NotNull(document, nameof(document));
|
Guard.NotNull(document);
|
||||||
|
|
||||||
var mappings = new WireMockOpenApiParser().FromDocument(document, settings);
|
var mappings = new WireMockOpenApiParser().FromDocument(document, settings);
|
||||||
|
|
||||||
return server.WithMapping(mappings.ToArray());
|
return server.WithMapping(mappings.ToArray());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Microsoft.OpenApi.Readers;
|
using Microsoft.OpenApi.Readers;
|
||||||
@@ -35,7 +35,7 @@ namespace WireMock.Net.OpenApiParser
|
|||||||
/// <param name="document">The source OpenApiDocument</param>
|
/// <param name="document">The source OpenApiDocument</param>
|
||||||
/// <param name="settings">Additional settings [optional]</param>
|
/// <param name="settings">Additional settings [optional]</param>
|
||||||
/// <returns>MappingModel</returns>
|
/// <returns>MappingModel</returns>
|
||||||
IEnumerable<MappingModel> FromDocument(OpenApiDocument document, WireMockOpenApiParserSettings settings = null);
|
IEnumerable<MappingModel> FromDocument(OpenApiDocument document, WireMockOpenApiParserSettings? settings = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate <see cref="IEnumerable{MappingModel}"/> from a <seealso cref="Stream"/>.
|
/// Generate <see cref="IEnumerable{MappingModel}"/> from a <seealso cref="Stream"/>.
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.OpenApi;
|
using Microsoft.OpenApi;
|
||||||
@@ -15,371 +16,365 @@ using WireMock.Net.OpenApiParser.Settings;
|
|||||||
using WireMock.Net.OpenApiParser.Types;
|
using WireMock.Net.OpenApiParser.Types;
|
||||||
using WireMock.Net.OpenApiParser.Utils;
|
using WireMock.Net.OpenApiParser.Utils;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Mappers
|
namespace WireMock.Net.OpenApiParser.Mappers;
|
||||||
|
|
||||||
|
internal class OpenApiPathsMapper
|
||||||
{
|
{
|
||||||
internal class OpenApiPathsMapper
|
private const string HeaderContentType = "Content-Type";
|
||||||
|
|
||||||
|
private readonly WireMockOpenApiParserSettings _settings;
|
||||||
|
private readonly ExampleValueGenerator _exampleValueGenerator;
|
||||||
|
|
||||||
|
public OpenApiPathsMapper(WireMockOpenApiParserSettings settings)
|
||||||
{
|
{
|
||||||
private const string HeaderContentType = "Content-Type";
|
_settings = Guard.NotNull(settings);
|
||||||
|
_exampleValueGenerator = new ExampleValueGenerator(settings);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly WireMockOpenApiParserSettings _settings;
|
public IEnumerable<MappingModel> ToMappingModels(OpenApiPaths paths, IList<OpenApiServer> servers)
|
||||||
private readonly ExampleValueGenerator _exampleValueGenerator;
|
{
|
||||||
|
return paths.Select(p => MapPath(p.Key, p.Value, servers)).SelectMany(x => x);
|
||||||
|
}
|
||||||
|
|
||||||
public OpenApiPathsMapper(WireMockOpenApiParserSettings settings)
|
private IEnumerable<MappingModel> MapPaths(OpenApiPaths paths, IList<OpenApiServer> servers)
|
||||||
|
{
|
||||||
|
return paths.Select(p => MapPath(p.Key, p.Value, servers)).SelectMany(x => x);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<MappingModel> MapPath(string path, OpenApiPathItem pathItem, IList<OpenApiServer> servers)
|
||||||
|
{
|
||||||
|
return pathItem.Operations.Select(o => MapOperationToMappingModel(path, o.Key.ToString().ToUpperInvariant(), o.Value, servers));
|
||||||
|
}
|
||||||
|
|
||||||
|
private MappingModel MapOperationToMappingModel(string path, string httpMethod, OpenApiOperation operation, IList<OpenApiServer> servers)
|
||||||
|
{
|
||||||
|
var queryParameters = operation.Parameters.Where(p => p.In == ParameterLocation.Query);
|
||||||
|
var pathParameters = operation.Parameters.Where(p => p.In == ParameterLocation.Path);
|
||||||
|
var headers = operation.Parameters.Where(p => p.In == ParameterLocation.Header);
|
||||||
|
|
||||||
|
var response = operation.Responses.FirstOrDefault();
|
||||||
|
|
||||||
|
TryGetContent(response.Value?.Content, out OpenApiMediaType? responseContent, out string? responseContentType);
|
||||||
|
var responseSchema = response.Value?.Content?.FirstOrDefault().Value?.Schema;
|
||||||
|
var responseExample = responseContent?.Example;
|
||||||
|
var responseSchemaExample = responseContent?.Schema?.Example;
|
||||||
|
|
||||||
|
var body = responseExample != null ? MapOpenApiAnyToJToken(responseExample) :
|
||||||
|
responseSchemaExample != null ? MapOpenApiAnyToJToken(responseSchemaExample) :
|
||||||
|
MapSchemaToObject(responseSchema);
|
||||||
|
|
||||||
|
var requestBodyModel = new BodyModel();
|
||||||
|
if (operation.RequestBody != null && operation.RequestBody.Content != null && operation.RequestBody.Required)
|
||||||
{
|
{
|
||||||
_settings = Guard.NotNull(settings, nameof(settings));
|
var request = operation.RequestBody.Content;
|
||||||
_exampleValueGenerator = new ExampleValueGenerator(settings);
|
TryGetContent(request, out OpenApiMediaType? requestContent, out _);
|
||||||
|
|
||||||
|
var requestBodySchema = operation.RequestBody.Content.First().Value?.Schema;
|
||||||
|
var requestBodyExample = requestContent!.Example;
|
||||||
|
var requestBodySchemaExample = requestContent.Schema?.Example;
|
||||||
|
|
||||||
|
var requestBodyMapped = requestBodyExample != null ? MapOpenApiAnyToJToken(requestBodyExample) :
|
||||||
|
requestBodySchemaExample != null ? MapOpenApiAnyToJToken(requestBodySchemaExample) :
|
||||||
|
MapSchemaToObject(requestBodySchema);
|
||||||
|
|
||||||
|
requestBodyModel = MapRequestBody(requestBodyMapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<MappingModel> ToMappingModels(OpenApiPaths paths, IList<OpenApiServer> servers)
|
if (!int.TryParse(response.Key, out var httpStatusCode))
|
||||||
{
|
{
|
||||||
return paths.Select(p => MapPath(p.Key, p.Value, servers)).SelectMany(x => x);
|
httpStatusCode = 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<MappingModel> MapPaths(OpenApiPaths paths, IList<OpenApiServer> servers)
|
return new MappingModel
|
||||||
{
|
{
|
||||||
return paths.Select(p => MapPath(p.Key, p.Value, servers)).SelectMany(x => x);
|
Guid = Guid.NewGuid(),
|
||||||
}
|
Request = new RequestModel
|
||||||
|
|
||||||
private IEnumerable<MappingModel> MapPath(string path, OpenApiPathItem pathItem, IList<OpenApiServer> servers)
|
|
||||||
{
|
|
||||||
return pathItem.Operations.Select(o => MapOperationToMappingModel(path, o.Key.ToString().ToUpperInvariant(), o.Value, servers));
|
|
||||||
}
|
|
||||||
|
|
||||||
private MappingModel MapOperationToMappingModel(string path, string httpMethod, OpenApiOperation operation, IList<OpenApiServer> servers)
|
|
||||||
{
|
|
||||||
var queryParameters = operation.Parameters.Where(p => p.In == ParameterLocation.Query);
|
|
||||||
var pathParameters = operation.Parameters.Where(p => p.In == ParameterLocation.Path);
|
|
||||||
var headers = operation.Parameters.Where(p => p.In == ParameterLocation.Header);
|
|
||||||
|
|
||||||
var response = operation.Responses.FirstOrDefault();
|
|
||||||
|
|
||||||
TryGetContent(response.Value?.Content, out OpenApiMediaType responseContent, out string responseContentType);
|
|
||||||
var responseSchema = response.Value?.Content?.FirstOrDefault().Value?.Schema;
|
|
||||||
var responseExample = responseContent?.Example;
|
|
||||||
var responseSchemaExample = responseContent?.Schema?.Example;
|
|
||||||
|
|
||||||
var body = responseExample != null ? MapOpenApiAnyToJToken(responseExample) :
|
|
||||||
responseSchemaExample != null ? MapOpenApiAnyToJToken(responseSchemaExample) :
|
|
||||||
MapSchemaToObject(responseSchema);
|
|
||||||
|
|
||||||
var requestBodyModel = new BodyModel();
|
|
||||||
if (operation.RequestBody != null && operation.RequestBody.Content != null && operation.RequestBody.Required)
|
|
||||||
{
|
{
|
||||||
var request = operation.RequestBody.Content;
|
Methods = new[] { httpMethod },
|
||||||
TryGetContent(request, out OpenApiMediaType requestContent, out string requestContentType);
|
Path = MapBasePath(servers) + MapPathWithParameters(path, pathParameters),
|
||||||
|
Params = MapQueryParameters(queryParameters),
|
||||||
var requestBodySchema = operation.RequestBody.Content.First().Value?.Schema;
|
Headers = MapRequestHeaders(headers),
|
||||||
var requestBodyExample = requestContent.Example;
|
Body = requestBodyModel
|
||||||
var requestBodySchemaExample = requestContent.Schema?.Example;
|
},
|
||||||
|
Response = new ResponseModel
|
||||||
var requestBodyMapped = requestBodyExample != null ? MapOpenApiAnyToJToken(requestBodyExample) :
|
{
|
||||||
requestBodySchemaExample != null ? MapOpenApiAnyToJToken(requestBodySchemaExample) :
|
StatusCode = httpStatusCode,
|
||||||
MapSchemaToObject(requestBodySchema);
|
Headers = MapHeaders(responseContentType, response.Value?.Headers),
|
||||||
|
BodyAsJson = body
|
||||||
requestBodyModel = MapRequestBody(requestBodyMapped);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (!int.TryParse(response.Key, out var httpStatusCode))
|
private BodyModel? MapRequestBody(object? requestBody)
|
||||||
|
{
|
||||||
|
if (requestBody == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BodyModel
|
||||||
|
{
|
||||||
|
Matcher = new MatcherModel
|
||||||
{
|
{
|
||||||
httpStatusCode = 200;
|
Name = "JsonMatcher",
|
||||||
|
Pattern = JsonConvert.SerializeObject(requestBody, Formatting.Indented),
|
||||||
|
IgnoreCase = _settings.RequestBodyIgnoreCase
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return new MappingModel
|
private bool TryGetContent(IDictionary<string, OpenApiMediaType>? contents, [NotNullWhen(true)] out OpenApiMediaType? openApiMediaType, [NotNullWhen(true)] out string? contentType)
|
||||||
{
|
{
|
||||||
Guid = Guid.NewGuid(),
|
openApiMediaType = null;
|
||||||
Request = new RequestModel
|
contentType = null;
|
||||||
|
|
||||||
|
if (contents == null || contents.Values.Count == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contents.TryGetValue("application/json", out var content))
|
||||||
|
{
|
||||||
|
openApiMediaType = content;
|
||||||
|
contentType = "application/json";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var first = contents.FirstOrDefault();
|
||||||
|
openApiMediaType = first.Value;
|
||||||
|
contentType = first.Key;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private object? MapSchemaToObject(OpenApiSchema? schema, string? name = null)
|
||||||
|
{
|
||||||
|
if (schema == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (schema.GetSchemaType())
|
||||||
|
{
|
||||||
|
case SchemaType.Array:
|
||||||
|
var jArray = new JArray();
|
||||||
|
for (int i = 0; i < _settings.NumberOfArrayItems; i++)
|
||||||
{
|
{
|
||||||
Methods = new[] { httpMethod },
|
if (schema.Items.Properties.Count > 0)
|
||||||
Path = MapBasePath(servers) + MapPathWithParameters(path, pathParameters),
|
|
||||||
Params = MapQueryParameters(queryParameters),
|
|
||||||
Headers = MapRequestHeaders(headers),
|
|
||||||
Body = requestBodyModel
|
|
||||||
},
|
|
||||||
Response = new ResponseModel
|
|
||||||
{
|
|
||||||
StatusCode = httpStatusCode,
|
|
||||||
Headers = MapHeaders(responseContentType, response.Value?.Headers),
|
|
||||||
BodyAsJson = body
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private BodyModel MapRequestBody(object requestBody)
|
|
||||||
{
|
|
||||||
if (requestBody == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BodyModel
|
|
||||||
{
|
|
||||||
Matcher = new MatcherModel
|
|
||||||
{
|
|
||||||
Name = "JsonMatcher",
|
|
||||||
Pattern = JsonConvert.SerializeObject(requestBody, Formatting.Indented),
|
|
||||||
IgnoreCase = _settings.RequestBodyIgnoreCase
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool TryGetContent(IDictionary<string, OpenApiMediaType> contents, out OpenApiMediaType openApiMediaType, out string contentType)
|
|
||||||
{
|
|
||||||
openApiMediaType = null;
|
|
||||||
contentType = null;
|
|
||||||
|
|
||||||
if (contents == null || contents.Values.Count == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contents.TryGetValue("application/json", out var content))
|
|
||||||
{
|
|
||||||
openApiMediaType = content;
|
|
||||||
contentType = "application/json";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var first = contents.FirstOrDefault();
|
|
||||||
openApiMediaType = first.Value;
|
|
||||||
contentType = first.Key;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private object MapSchemaToObject(OpenApiSchema schema, string name = null)
|
|
||||||
{
|
|
||||||
if (schema == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (schema.GetSchemaType())
|
|
||||||
{
|
|
||||||
case SchemaType.Array:
|
|
||||||
var jArray = new JArray();
|
|
||||||
for (int i = 0; i < _settings.NumberOfArrayItems; i++)
|
|
||||||
{
|
{
|
||||||
if (schema.Items.Properties.Count > 0)
|
var arrayItem = new JObject();
|
||||||
|
foreach (var property in schema.Items.Properties)
|
||||||
{
|
{
|
||||||
var arrayItem = new JObject();
|
var objectValue = MapSchemaToObject(property.Value, property.Key);
|
||||||
foreach (var property in schema.Items.Properties)
|
if (objectValue is JProperty jp)
|
||||||
{
|
{
|
||||||
var objectValue = MapSchemaToObject(property.Value, property.Key);
|
arrayItem.Add(jp);
|
||||||
if (objectValue is JProperty jp)
|
|
||||||
{
|
|
||||||
arrayItem.Add(jp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
arrayItem.Add(new JProperty(property.Key, objectValue));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
jArray.Add(arrayItem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jArray.Add(MapSchemaToObject(schema.Items, name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (schema.AllOf.Count > 0)
|
|
||||||
{
|
|
||||||
jArray.Add(MapSchemaAllOfToObject(schema));
|
|
||||||
}
|
|
||||||
|
|
||||||
return jArray;
|
|
||||||
|
|
||||||
case SchemaType.Boolean:
|
|
||||||
case SchemaType.Integer:
|
|
||||||
case SchemaType.Number:
|
|
||||||
case SchemaType.String:
|
|
||||||
return _exampleValueGenerator.GetExampleValue(schema);
|
|
||||||
|
|
||||||
case SchemaType.Object:
|
|
||||||
var propertyAsJObject = new JObject();
|
|
||||||
foreach (var schemaProperty in schema.Properties)
|
|
||||||
{
|
|
||||||
propertyAsJObject.Add(MapPropertyAsJObject(schemaProperty.Value, schemaProperty.Key));
|
|
||||||
}
|
|
||||||
if (schema.AllOf.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (var property in schema.AllOf)
|
|
||||||
{
|
|
||||||
foreach (var item in property.Properties)
|
|
||||||
{
|
{
|
||||||
propertyAsJObject.Add(MapPropertyAsJObject(item.Value, item.Key));
|
arrayItem.Add(new JProperty(property.Key, objectValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jArray.Add(arrayItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jArray.Add(MapSchemaToObject(schema.Items, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return name != null ? new JProperty(name, propertyAsJObject) : (JToken)propertyAsJObject;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private JObject MapSchemaAllOfToObject(OpenApiSchema schema)
|
|
||||||
{
|
|
||||||
var arrayItem = new JObject();
|
|
||||||
foreach (var property in schema.AllOf)
|
|
||||||
{
|
|
||||||
foreach (var item in property.Properties)
|
|
||||||
{
|
|
||||||
arrayItem.Add(MapPropertyAsJObject(item.Value, item.Key));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return arrayItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
private object MapPropertyAsJObject(OpenApiSchema openApiSchema, string key)
|
if (schema.AllOf.Count > 0)
|
||||||
{
|
|
||||||
if (openApiSchema.GetSchemaType() == SchemaType.Object || openApiSchema.GetSchemaType() == SchemaType.Array)
|
|
||||||
{
|
|
||||||
var mapped = MapSchemaToObject(openApiSchema, key);
|
|
||||||
if (mapped is JProperty jp)
|
|
||||||
{
|
{
|
||||||
return jp;
|
jArray.Add(MapSchemaAllOfToObject(schema));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
return jArray;
|
||||||
|
|
||||||
|
case SchemaType.Boolean:
|
||||||
|
case SchemaType.Integer:
|
||||||
|
case SchemaType.Number:
|
||||||
|
case SchemaType.String:
|
||||||
|
return _exampleValueGenerator.GetExampleValue(schema);
|
||||||
|
|
||||||
|
case SchemaType.Object:
|
||||||
|
var propertyAsJObject = new JObject();
|
||||||
|
foreach (var schemaProperty in schema.Properties)
|
||||||
{
|
{
|
||||||
return new JProperty(key, mapped);
|
propertyAsJObject.Add(MapPropertyAsJObject(schemaProperty.Value, schemaProperty.Key));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
if (schema.AllOf.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var property in schema.AllOf)
|
||||||
|
{
|
||||||
|
foreach (var item in property.Properties)
|
||||||
|
{
|
||||||
|
propertyAsJObject.Add(MapPropertyAsJObject(item.Value, item.Key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return name != null ? new JProperty(name, propertyAsJObject) : propertyAsJObject;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private JObject MapSchemaAllOfToObject(OpenApiSchema schema)
|
||||||
|
{
|
||||||
|
var arrayItem = new JObject();
|
||||||
|
foreach (var property in schema.AllOf)
|
||||||
|
{
|
||||||
|
foreach (var item in property.Properties)
|
||||||
{
|
{
|
||||||
// bool propertyIsNullable = openApiSchema.Nullable || (openApiSchema.TryGetXNullable(out bool x) && x);
|
arrayItem.Add(MapPropertyAsJObject(item.Value, item.Key));
|
||||||
return new JProperty(key, _exampleValueGenerator.GetExampleValue(openApiSchema));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return arrayItem;
|
||||||
|
}
|
||||||
|
|
||||||
private string MapPathWithParameters(string path, IEnumerable<OpenApiParameter> parameters)
|
private object MapPropertyAsJObject(OpenApiSchema openApiSchema, string key)
|
||||||
|
{
|
||||||
|
if (openApiSchema.GetSchemaType() == SchemaType.Object || openApiSchema.GetSchemaType() == SchemaType.Array)
|
||||||
{
|
{
|
||||||
if (parameters == null)
|
var mapped = MapSchemaToObject(openApiSchema, key);
|
||||||
|
if (mapped is JProperty jp)
|
||||||
{
|
{
|
||||||
return path;
|
return jp;
|
||||||
}
|
}
|
||||||
|
|
||||||
string newPath = path;
|
return new JProperty(key, mapped);
|
||||||
foreach (var parameter in parameters)
|
|
||||||
{
|
|
||||||
var exampleMatcherModel = GetExampleMatcherModel(parameter.Schema, _settings.PathPatternToUse);
|
|
||||||
newPath = newPath.Replace($"{{{parameter.Name}}}", exampleMatcherModel.Pattern as string);
|
|
||||||
}
|
|
||||||
|
|
||||||
return newPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string MapBasePath(IList<OpenApiServer> servers)
|
// bool propertyIsNullable = openApiSchema.Nullable || (openApiSchema.TryGetXNullable(out bool x) && x);
|
||||||
|
return new JProperty(key, _exampleValueGenerator.GetExampleValue(openApiSchema));
|
||||||
|
}
|
||||||
|
|
||||||
|
private string MapPathWithParameters(string path, IEnumerable<OpenApiParameter>? parameters)
|
||||||
|
{
|
||||||
|
if (parameters == null)
|
||||||
{
|
{
|
||||||
if (servers == null || servers.Count == 0)
|
return path;
|
||||||
{
|
}
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
OpenApiServer server = servers.First();
|
string newPath = path;
|
||||||
if (Uri.TryCreate(server.Url, UriKind.RelativeOrAbsolute, out Uri uriResult))
|
foreach (var parameter in parameters)
|
||||||
{
|
{
|
||||||
return uriResult.IsAbsoluteUri ? uriResult.AbsolutePath : uriResult.ToString();
|
var exampleMatcherModel = GetExampleMatcherModel(parameter.Schema, _settings.PathPatternToUse);
|
||||||
}
|
newPath = newPath.Replace($"{{{parameter.Name}}}", exampleMatcherModel.Pattern as string);
|
||||||
|
}
|
||||||
|
|
||||||
|
return newPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string MapBasePath(IList<OpenApiServer>? servers)
|
||||||
|
{
|
||||||
|
if (servers == null || servers.Count == 0)
|
||||||
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JToken MapOpenApiAnyToJToken(IOpenApiAny any)
|
OpenApiServer server = servers.First();
|
||||||
|
if (Uri.TryCreate(server.Url, UriKind.RelativeOrAbsolute, out Uri uriResult))
|
||||||
{
|
{
|
||||||
if (any == null)
|
return uriResult.IsAbsoluteUri ? uriResult.AbsolutePath : uriResult.ToString();
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
using var outputString = new StringWriter();
|
|
||||||
var writer = new OpenApiJsonWriter(outputString);
|
|
||||||
any.Write(writer, OpenApiSpecVersion.OpenApi3_0);
|
|
||||||
|
|
||||||
if (any.AnyType == AnyType.Array)
|
|
||||||
{
|
|
||||||
return JArray.Parse(outputString.ToString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return JObject.Parse(outputString.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IDictionary<string, object> MapHeaders(string responseContentType, IDictionary<string, OpenApiHeader> headers)
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JToken? MapOpenApiAnyToJToken(IOpenApiAny? any)
|
||||||
|
{
|
||||||
|
if (any == null)
|
||||||
{
|
{
|
||||||
var mappedHeaders = headers.ToDictionary(
|
return null;
|
||||||
item => item.Key,
|
|
||||||
item => GetExampleMatcherModel(null, _settings.HeaderPatternToUse).Pattern
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(responseContentType))
|
|
||||||
{
|
|
||||||
mappedHeaders.TryAdd(HeaderContentType, responseContentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mappedHeaders.Keys.Any() ? mappedHeaders : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IList<ParamModel> MapQueryParameters(IEnumerable<OpenApiParameter> queryParameters)
|
using var outputString = new StringWriter();
|
||||||
|
var writer = new OpenApiJsonWriter(outputString);
|
||||||
|
any.Write(writer, OpenApiSpecVersion.OpenApi3_0);
|
||||||
|
|
||||||
|
if (any.AnyType == AnyType.Array)
|
||||||
{
|
{
|
||||||
var list = queryParameters
|
return JArray.Parse(outputString.ToString());
|
||||||
.Where(req => req.Required)
|
}
|
||||||
.Select(qp => new ParamModel
|
|
||||||
|
return JObject.Parse(outputString.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private IDictionary<string, object?>? MapHeaders(string responseContentType, IDictionary<string, OpenApiHeader> headers)
|
||||||
|
{
|
||||||
|
var mappedHeaders = headers.ToDictionary(
|
||||||
|
item => item.Key,
|
||||||
|
_ => GetExampleMatcherModel(null, _settings.HeaderPatternToUse).Pattern
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(responseContentType))
|
||||||
|
{
|
||||||
|
mappedHeaders.TryAdd(HeaderContentType, responseContentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mappedHeaders.Keys.Any() ? mappedHeaders : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IList<ParamModel>? MapQueryParameters(IEnumerable<OpenApiParameter> queryParameters)
|
||||||
|
{
|
||||||
|
var list = queryParameters
|
||||||
|
.Where(req => req.Required)
|
||||||
|
.Select(qp => new ParamModel
|
||||||
|
{
|
||||||
|
Name = qp.Name,
|
||||||
|
IgnoreCase = _settings.QueryParameterPatternIgnoreCase,
|
||||||
|
Matchers = new[]
|
||||||
{
|
{
|
||||||
Name = qp.Name,
|
GetExampleMatcherModel(qp.Schema, _settings.QueryParameterPatternToUse)
|
||||||
IgnoreCase = _settings.QueryParameterPatternIgnoreCase,
|
}
|
||||||
Matchers = new[]
|
})
|
||||||
{
|
.ToList();
|
||||||
GetExampleMatcherModel(qp.Schema, _settings.QueryParameterPatternToUse)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return list.Any() ? list : null;
|
return list.Any() ? list : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IList<HeaderModel> MapRequestHeaders(IEnumerable<OpenApiParameter> headers)
|
private IList<HeaderModel>? MapRequestHeaders(IEnumerable<OpenApiParameter> headers)
|
||||||
{
|
{
|
||||||
var list = headers
|
var list = headers
|
||||||
.Where(req => req.Required)
|
.Where(req => req.Required)
|
||||||
.Select(qp => new HeaderModel
|
.Select(qp => new HeaderModel
|
||||||
|
{
|
||||||
|
Name = qp.Name,
|
||||||
|
IgnoreCase = _settings.HeaderPatternIgnoreCase,
|
||||||
|
Matchers = new[]
|
||||||
{
|
{
|
||||||
Name = qp.Name,
|
GetExampleMatcherModel(qp.Schema, _settings.HeaderPatternToUse)
|
||||||
IgnoreCase = _settings.HeaderPatternIgnoreCase,
|
}
|
||||||
Matchers = new[]
|
})
|
||||||
{
|
.ToList();
|
||||||
GetExampleMatcherModel(qp.Schema, _settings.HeaderPatternToUse)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return list.Any() ? list : null;
|
return list.Any() ? list : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MatcherModel GetExampleMatcherModel(OpenApiSchema schema, ExampleValueType type)
|
private MatcherModel GetExampleMatcherModel(OpenApiSchema? schema, ExampleValueType type)
|
||||||
|
{
|
||||||
|
return type switch
|
||||||
{
|
{
|
||||||
return type switch
|
ExampleValueType.Value => new MatcherModel { Name = "ExactMatcher", Pattern = GetExampleValueAsStringForSchemaType(schema), IgnoreCase = _settings.IgnoreCaseExampleValues },
|
||||||
{
|
|
||||||
ExampleValueType.Value => new MatcherModel { Name = "ExactMatcher", Pattern = GetExampleValueAsStringForSchemaType(schema), IgnoreCase = _settings.IgnoreCaseExampleValues },
|
|
||||||
|
|
||||||
_ => new MatcherModel { Name = "WildcardMatcher", Pattern = "*" }
|
_ => new MatcherModel { Name = "WildcardMatcher", Pattern = "*" }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetExampleValueAsStringForSchemaType(OpenApiSchema schema)
|
private string GetExampleValueAsStringForSchemaType(OpenApiSchema? schema)
|
||||||
|
{
|
||||||
|
var value = _exampleValueGenerator.GetExampleValue(schema);
|
||||||
|
|
||||||
|
return value switch
|
||||||
{
|
{
|
||||||
var value = _exampleValueGenerator.GetExampleValue(schema);
|
string valueAsString => valueAsString,
|
||||||
|
|
||||||
return value switch
|
_ => value.ToString(),
|
||||||
{
|
};
|
||||||
string valueAsString => valueAsString,
|
|
||||||
|
|
||||||
_ => value.ToString(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,58 +1,60 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Settings
|
namespace WireMock.Net.OpenApiParser.Settings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A interface defining the example values to use for the different types.
|
||||||
|
/// </summary>
|
||||||
|
public interface IWireMockOpenApiParserExampleValues
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A interface defining the example values to use for the different types.
|
/// An example value for a Boolean.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWireMockOpenApiParserExampleValues
|
bool Boolean { get; set; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An example value for a Boolean.
|
|
||||||
/// </summary>
|
|
||||||
bool Boolean { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// An example value for an Integer.
|
|
||||||
/// </summary>
|
|
||||||
int Integer { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// An example value for a Float.
|
|
||||||
/// </summary>
|
|
||||||
float Float { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// An example value for a Double.
|
|
||||||
/// </summary>
|
|
||||||
double Double { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An example value for a Date.
|
/// An example value for an Integer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Func<DateTime> Date { get; set; }
|
int Integer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An example value for a DateTime.
|
/// An example value for a Float.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Func<DateTime> DateTime { get; set; }
|
float Float { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An example value for Bytes.
|
/// An example value for a Double.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
byte[] Bytes { get; set; }
|
double Double { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An example value for a Object.
|
/// An example value for a Date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
object Object { get; set; }
|
Func<DateTime> Date { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An example value for a String.
|
/// An example value for a DateTime.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string String { get; set; }
|
Func<DateTime> DateTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OpenApi Schema to generate dynamic examples more accurate
|
/// An example value for Bytes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
OpenApiSchema Schema { get; set; }
|
byte[] Bytes { get; set; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// An example value for a Object.
|
||||||
|
/// </summary>
|
||||||
|
object Object { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An example value for a String.
|
||||||
|
/// </summary>
|
||||||
|
string String { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OpenApi Schema to generate dynamic examples more accurate
|
||||||
|
/// </summary>
|
||||||
|
OpenApiSchema? Schema { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,34 +1,42 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using RandomDataGenerator.FieldOptions;
|
using RandomDataGenerator.FieldOptions;
|
||||||
using RandomDataGenerator.Randomizers;
|
using RandomDataGenerator.Randomizers;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Settings
|
namespace WireMock.Net.OpenApiParser.Settings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A class defining the random example values to use for the different types.
|
||||||
|
/// </summary>
|
||||||
|
public class WireMockOpenApiParserDynamicExampleValues : IWireMockOpenApiParserExampleValues
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// A class defining the random example values to use for the different types.
|
public virtual bool Boolean { get => RandomizerFactory.GetRandomizer(new FieldOptionsBoolean()).Generate() ?? true; set { } }
|
||||||
/// </summary>
|
|
||||||
public class WireMockOpenApiParserDynamicExampleValues : IWireMockOpenApiParserExampleValues
|
/// <inheritdoc />
|
||||||
{
|
public virtual int Integer { get => RandomizerFactory.GetRandomizer(new FieldOptionsInteger()).Generate() ?? 42; set { } }
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual bool Boolean { get { return RandomizerFactory.GetRandomizer(new FieldOptionsBoolean()).Generate() ?? true; } set { } }
|
/// <inheritdoc />
|
||||||
/// <inheritdoc />
|
public virtual float Float { get => RandomizerFactory.GetRandomizer(new FieldOptionsFloat()).Generate() ?? 4.2f; set { } }
|
||||||
public virtual int Integer { get { return RandomizerFactory.GetRandomizer(new FieldOptionsInteger()).Generate() ?? 42; } set { } }
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual float Float { get { return RandomizerFactory.GetRandomizer(new FieldOptionsFloat()).Generate() ?? 4.2f; } set { } }
|
public virtual double Double { get => RandomizerFactory.GetRandomizer(new FieldOptionsDouble()).Generate() ?? 4.2d; set { } }
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual double Double { get { return RandomizerFactory.GetRandomizer(new FieldOptionsDouble()).Generate() ?? 4.2d; } set { } }
|
/// <inheritdoc />
|
||||||
/// <inheritdoc />
|
public virtual Func<DateTime> Date { get { return () => RandomizerFactory.GetRandomizer(new FieldOptionsDateTime()).Generate() ?? System.DateTime.UtcNow.Date; } set { } }
|
||||||
public virtual Func<DateTime> Date { get { return () => RandomizerFactory.GetRandomizer(new FieldOptionsDateTime()).Generate() ?? System.DateTime.UtcNow.Date; } set { } }
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual Func<DateTime> DateTime { get { return () => RandomizerFactory.GetRandomizer(new FieldOptionsDateTime()).Generate() ?? System.DateTime.UtcNow; } set { } }
|
public virtual Func<DateTime> DateTime { get { return () => RandomizerFactory.GetRandomizer(new FieldOptionsDateTime()).Generate() ?? System.DateTime.UtcNow; } set { } }
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual byte[] Bytes { get { return RandomizerFactory.GetRandomizer(new FieldOptionsBytes()).Generate(); } set { } }
|
/// <inheritdoc />
|
||||||
/// <inheritdoc />
|
public virtual byte[] Bytes { get => RandomizerFactory.GetRandomizer(new FieldOptionsBytes()).Generate(); set { } }
|
||||||
public virtual object Object { get; set; } = "example-object";
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual string String { get { return RandomizerFactory.GetRandomizer(new FieldOptionsTextRegex { Pattern = @"^[0-9]{2}[A-Z]{5}[0-9]{2}" }).Generate() ?? "example-string"; } set { } }
|
public virtual object Object { get; set; } = "example-object";
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual OpenApiSchema Schema { get; set; }
|
/// <inheritdoc />
|
||||||
}
|
public virtual string String { get => RandomizerFactory.GetRandomizer(new FieldOptionsTextRegex { Pattern = @"^[0-9]{2}[A-Z]{5}[0-9]{2}" }).Generate() ?? "example-string"; set { } }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public virtual OpenApiSchema? Schema { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,32 +1,40 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Settings
|
namespace WireMock.Net.OpenApiParser.Settings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A class defining the example values to use for the different types.
|
||||||
|
/// </summary>
|
||||||
|
public class WireMockOpenApiParserExampleValues : IWireMockOpenApiParserExampleValues
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// A class defining the example values to use for the different types.
|
public virtual bool Boolean { get; set; } = true;
|
||||||
/// </summary>
|
|
||||||
public class WireMockOpenApiParserExampleValues : IWireMockOpenApiParserExampleValues
|
/// <inheritdoc />
|
||||||
{
|
public virtual int Integer { get; set; } = 42;
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual bool Boolean { get; set; } = true;
|
/// <inheritdoc />
|
||||||
/// <inheritdoc />
|
public virtual float Float { get; set; } = 4.2f;
|
||||||
public virtual int Integer { get; set; } = 42;
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual float Float { get; set; } = 4.2f;
|
public virtual double Double { get; set; } = 4.2d;
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual double Double { get; set; } = 4.2d;
|
/// <inheritdoc />
|
||||||
/// <inheritdoc />
|
public virtual Func<DateTime> Date { get; set; } = () => System.DateTime.UtcNow.Date;
|
||||||
public virtual Func<DateTime> Date { get; set; } = () => System.DateTime.UtcNow.Date;
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual Func<DateTime> DateTime { get; set; } = () => System.DateTime.UtcNow;
|
public virtual Func<DateTime> DateTime { get; set; } = () => System.DateTime.UtcNow;
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual byte[] Bytes { get; set; } = { 48, 49, 50 };
|
/// <inheritdoc />
|
||||||
/// <inheritdoc />
|
public virtual byte[] Bytes { get; set; } = { 48, 49, 50 };
|
||||||
public virtual object Object { get; set; } = "example-object";
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual string String { get; set; } = "example-string";
|
public virtual object Object { get; set; } = "example-object";
|
||||||
/// <inheritdoc />
|
|
||||||
public virtual OpenApiSchema Schema { get; set; } = new OpenApiSchema();
|
/// <inheritdoc />
|
||||||
}
|
public virtual string String { get; set; } = "example-string";
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public virtual OpenApiSchema? Schema { get; set; } = new OpenApiSchema();
|
||||||
}
|
}
|
||||||
@@ -1,64 +1,63 @@
|
|||||||
using WireMock.Net.OpenApiParser.Types;
|
using WireMock.Net.OpenApiParser.Types;
|
||||||
|
|
||||||
namespace WireMock.Net.OpenApiParser.Settings
|
namespace WireMock.Net.OpenApiParser.Settings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The WireMockOpenApiParser Settings
|
||||||
|
/// </summary>
|
||||||
|
public class WireMockOpenApiParserSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The WireMockOpenApiParser Settings
|
/// The number of array items to generate (default is 3).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WireMockOpenApiParserSettings
|
public int NumberOfArrayItems { get; set; } = 3;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The number of array items to generate (default is 3).
|
|
||||||
/// </summary>
|
|
||||||
public int NumberOfArrayItems { get; set; } = 3;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The example value type to use when generating a Path
|
/// The example value type to use when generating a Path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ExampleValueType PathPatternToUse { get; set; } = ExampleValueType.Value;
|
public ExampleValueType PathPatternToUse { get; set; } = ExampleValueType.Value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The example value type to use when generating a Header
|
/// The example value type to use when generating a Header
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ExampleValueType HeaderPatternToUse { get; set; } = ExampleValueType.Value;
|
public ExampleValueType HeaderPatternToUse { get; set; } = ExampleValueType.Value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The example value type to use when generating a Query Parameter
|
/// The example value type to use when generating a Query Parameter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ExampleValueType QueryParameterPatternToUse { get; set; } = ExampleValueType.Value;
|
public ExampleValueType QueryParameterPatternToUse { get; set; } = ExampleValueType.Value;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The example values to use.
|
/// The example values to use.
|
||||||
///
|
///
|
||||||
/// Default implementations are:
|
/// Default implementations are:
|
||||||
/// - <see cref="WireMockOpenApiParserExampleValues"/>
|
/// - <see cref="WireMockOpenApiParserExampleValues"/>
|
||||||
/// - <see cref="WireMockOpenApiParserDynamicExampleValues"/>
|
/// - <see cref="WireMockOpenApiParserDynamicExampleValues"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IWireMockOpenApiParserExampleValues ExampleValues { get; set; }
|
public IWireMockOpenApiParserExampleValues? ExampleValues { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is a Header match case insensitive? (default is true).
|
/// Is a Header match case insensitive? (default is true).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HeaderPatternIgnoreCase { get; set; } = true;
|
public bool HeaderPatternIgnoreCase { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is a Query Parameter match case insensitive? (default is true).
|
/// Is a Query Parameter match case insensitive? (default is true).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool QueryParameterPatternIgnoreCase { get; set; } = true;
|
public bool QueryParameterPatternIgnoreCase { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is a Request Body match case insensitive? (default is true).
|
/// Is a Request Body match case insensitive? (default is true).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool RequestBodyIgnoreCase { get; set; } = true;
|
public bool RequestBodyIgnoreCase { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is a ExampleValue match case insensitive? (default is true).
|
/// Is a ExampleValue match case insensitive? (default is true).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IgnoreCaseExampleValues { get; set; } = true;
|
public bool IgnoreCaseExampleValues { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Are examples generated dynamically? (default is false).
|
/// Are examples generated dynamically? (default is false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DynamicExamples { get; set; } = false;
|
public bool DynamicExamples { get; set; } = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
namespace WireMock.Net.OpenApiParser.Types
|
namespace WireMock.Net.OpenApiParser.Types;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The example value to use
|
||||||
|
/// </summary>
|
||||||
|
public enum ExampleValueType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The example value to use
|
/// 1. Use a generated example value based on the SchemaType (default).
|
||||||
|
/// 2. If there is no example value defined in the schema,
|
||||||
|
/// then the <see cref="Settings.IWireMockOpenApiParserExampleValues"/> will be used (custom, fixed or dynamic).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ExampleValueType
|
Value,
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 1. Use a generated example value based on the SchemaType (default).
|
|
||||||
/// 2. If there is no example value defined in the schema,
|
|
||||||
/// then the <see cref="Settings.IWireMockOpenApiParserExampleValues"/> will be used (custom, fixed or dynamic).
|
|
||||||
/// </summary>
|
|
||||||
Value,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Just use a Wildcard (*) character.
|
/// Just use a Wildcard (*) character.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Wildcard
|
Wildcard
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user