-
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
220 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("WireMock.Net.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100e138ec44d93acac565953052636eb8d5e7e9f27ddb030590055cd1a0ab2069a5623f1f77ca907d78e0b37066ca0f6d63da7eecc3fcb65b76aa8ebeccf7ebe1d11264b8404cd9b1cbbf2c83f566e033b3e54129f6ef28daffff776ba7aebbc53c0d635ebad8f45f78eb3f7e0459023c218f003416e080f96a1a3c5ffeb56bee9e")] | ||
|
||
// Needed for Moq in the UnitTest project | ||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] |
47 changes: 47 additions & 0 deletions
47
src/WireMock.Net.MimeKitLite/RequestBuilders/IRequestBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// ReSharper disable InconsistentNaming | ||
using WireMock.Matchers; | ||
using WireMock.Matchers.Request; | ||
|
||
namespace WireMock.RequestBuilders; | ||
|
||
/// <summary> | ||
/// IRequestBuilderExtensions extensions for MultiPart Mime using MimeKitLite. | ||
/// </summary> | ||
public static class IRequestBuilderExtensions | ||
{ | ||
/// <summary> | ||
/// WithMultiPart: IMatcher | ||
/// </summary> | ||
/// <param name="requestBuilder">The <see cref="IRequestBuilder"/>.</param> | ||
/// <param name="matcher">The matcher.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
public static IRequestBuilder WithMultiPart(this IRequestBuilder requestBuilder, IMatcher matcher) | ||
{ | ||
return requestBuilder.Add(new RequestMessageMultiPartMatcher(matcher)); | ||
} | ||
|
||
/// <summary> | ||
/// WithMultiPart: IMatcher[], MatchBehaviour and MatchOperator | ||
/// </summary> | ||
/// <param name="requestBuilder">The <see cref="IRequestBuilder"/>.</param> | ||
/// <param name="matchers">The matchers.</param> | ||
/// <param name="matchBehaviour">The <see cref="MatchBehaviour"/> to use.</param> | ||
/// <param name="matchOperator">The <see cref="MatchOperator"/> to use.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
public static IRequestBuilder WithMultiPart(this IRequestBuilder requestBuilder, IMatcher[] matchers, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch, MatchOperator matchOperator = MatchOperator.Or) | ||
{ | ||
return requestBuilder.Add(new RequestMessageMultiPartMatcher(matchBehaviour, matchOperator, matchers)); | ||
} | ||
|
||
/// <summary> | ||
/// WithMultiPart: MatchBehaviour and IMatcher[] | ||
/// </summary> | ||
/// <param name="requestBuilder">The <see cref="IRequestBuilder"/>.</param> | ||
/// <param name="matchBehaviour">The <see cref="MatchBehaviour"/> to use.</param> | ||
/// <param name="matchers">The matchers.</param> | ||
/// <returns>The <see cref="IRequestBuilder"/>.</returns> | ||
public static IRequestBuilder WithMultiPart(this IRequestBuilder requestBuilder, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch, params IMatcher[] matchers) | ||
{ | ||
return requestBuilder.Add(new RequestMessageMultiPartMatcher(matchBehaviour, MatchOperator.Or, matchers)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/WireMock.Net.MimeKitLite/WireMock.Net.MimeKitLite.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Description>MultiPart Mime support for WireMock.Net</Description> | ||
<AssemblyTitle>WireMock.Net.Matchers.GraphQL</AssemblyTitle> | ||
<Authors>Stef Heyenrath</Authors> | ||
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net47;net48;net6.0;net8.0</TargetFrameworks> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<PackageTags>wiremock;matchers;matcher;graphql</PackageTags> | ||
<RootNamespace>WireMock</RootNamespace> | ||
<ProjectGuid>{F8B4A93E-46EF-4237-88FE-15FDAB7635D4}</ProjectGuid> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> | ||
<CodeAnalysisRuleSet>../WireMock.Net/WireMock.Net.ruleset</CodeAnalysisRuleSet> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>../WireMock.Net/WireMock.Net.snk</AssemblyOriginatorKeyFile> | ||
<!--<DelaySign>true</DelaySign>--> | ||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" PrivateAssets="All" /> | ||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> | ||
<PackageReference Include="MimeKitLite" Version="4.1.0.1" /> | ||
|
||
<ProjectReference Include="..\WireMock.Net\WireMock.Net.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace WireMock.Matchers; | ||
|
||
/// <summary> | ||
/// MimePartMatcher | ||
/// </summary> | ||
/// <inheritdoc cref="IMatcher"/> | ||
public interface IMimePartMatcher : IMatcher | ||
{ | ||
/// <summary> | ||
/// ContentType Matcher (image/png; name=image.png.) | ||
/// </summary> | ||
IStringMatcher? ContentTypeMatcher { get; } | ||
|
||
/// <summary> | ||
/// ContentDisposition Matcher (attachment; filename=image.png) | ||
/// </summary> | ||
IStringMatcher? ContentDispositionMatcher { get; } | ||
|
||
/// <summary> | ||
/// ContentTransferEncoding Matcher (base64) | ||
/// </summary> | ||
IStringMatcher? ContentTransferEncodingMatcher { get; } | ||
|
||
/// <summary> | ||
/// Content Matcher | ||
/// </summary> | ||
IMatcher? ContentMatcher { get; } | ||
} |
17 changes: 17 additions & 0 deletions
17
src/WireMock.Net/Matchers/Request/IRequestMessageMultiPartMatcher.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace WireMock.Matchers.Request; | ||
|
||
/// <summary> | ||
/// The request body MultiPart matcher. | ||
/// </summary> | ||
public interface IRequestMessageMultiPartMatcher : IRequestMatcher | ||
{ | ||
/// <summary> | ||
/// The matchers. | ||
/// </summary> | ||
IMatcher[]? Matchers { get; } | ||
|
||
/// <summary> | ||
/// The <see cref="MatchOperator"/> | ||
/// </summary> | ||
MatchOperator MatchOperator { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.