mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-01 14:43:04 +02:00
Rename to WireMock.Net
This commit is contained in:
68
src/WireMock.Net/RequestBuilders/IBodyRequestBuilder.cs
Normal file
68
src/WireMock.Net/RequestBuilders/IBodyRequestBuilder.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
namespace WireMock.RequestBuilders
|
||||
{
|
||||
/// <summary>
|
||||
/// The BodyRequestBuilder interface.
|
||||
/// </summary>
|
||||
public interface IBodyRequestBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// The with body.
|
||||
/// </summary>
|
||||
/// <param name="matcher">
|
||||
/// The matcher.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
IRequestMatcher WithBody([NotNull] IMatcher matcher);
|
||||
|
||||
/// <summary>
|
||||
/// The with body.
|
||||
/// </summary>
|
||||
/// <param name="body">
|
||||
/// The body.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
IRequestMatcher WithBody(string body);
|
||||
|
||||
/// <summary>
|
||||
/// The with body byte[].
|
||||
/// </summary>
|
||||
/// <param name="body">
|
||||
/// The body as byte[].
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
IRequestMatcher WithBody(byte[] body);
|
||||
|
||||
/// <summary>
|
||||
/// The with body string func.
|
||||
/// </summary>
|
||||
/// <param name="body">
|
||||
/// The body string function.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
IRequestMatcher WithBody(Func<string, bool> body);
|
||||
|
||||
/// <summary>
|
||||
/// The with body byte[] func.
|
||||
/// </summary>
|
||||
/// <param name="body">
|
||||
/// The body byte[] function.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
IRequestMatcher WithBody(Func<byte[], bool> body);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using WireMock.Matchers.Request;
|
||||
|
||||
namespace WireMock.RequestBuilders
|
||||
{
|
||||
/// <summary>
|
||||
/// The HeadersAndCookieRequestBuilder interface.
|
||||
/// </summary>
|
||||
public interface IHeadersAndCookiesRequestBuilder : IBodyRequestBuilder, IRequestMatcher, IParamsRequestBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// The with header.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="pattern">The pattern.</param>
|
||||
/// <param name="ignoreCase">ignore Case</param>
|
||||
/// <returns>The <see cref="IHeadersAndCookiesRequestBuilder"/>.</returns>
|
||||
IHeadersAndCookiesRequestBuilder WithHeader(string name, string pattern, bool ignoreCase = true);
|
||||
|
||||
/// <summary>
|
||||
/// The with header.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The headers funcs.</param>
|
||||
/// <returns>The <see cref="IHeadersAndCookiesRequestBuilder"/>.</returns>
|
||||
IHeadersAndCookiesRequestBuilder WithHeader([NotNull] params Func<IDictionary<string, string>, bool>[] funcs);
|
||||
|
||||
/// <summary>
|
||||
/// The with header.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="pattern">The pattern.</param>
|
||||
/// <param name="ignoreCase">ignore Case</param>
|
||||
/// <returns>The <see cref="IHeadersAndCookiesRequestBuilder"/>.</returns>
|
||||
IHeadersAndCookiesRequestBuilder WithCookie(string name, string pattern, bool ignoreCase = true);
|
||||
|
||||
/// <summary>
|
||||
/// The with header.
|
||||
/// </summary>
|
||||
/// <param name="cookieFuncs">The funcs.</param>
|
||||
/// <returns>The <see cref="IHeadersAndCookiesRequestBuilder"/>.</returns>
|
||||
IHeadersAndCookiesRequestBuilder WithCookie([NotNull] params Func<IDictionary<string, string>, bool>[] cookieFuncs);
|
||||
}
|
||||
}
|
||||
35
src/WireMock.Net/RequestBuilders/IParamsRequestBuilder.cs
Normal file
35
src/WireMock.Net/RequestBuilders/IParamsRequestBuilder.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Util;
|
||||
|
||||
namespace WireMock.RequestBuilders
|
||||
{
|
||||
/// <summary>
|
||||
/// The ParametersRequestBuilder interface.
|
||||
/// </summary>
|
||||
public interface IParamsRequestBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// The with parameters.
|
||||
/// </summary>
|
||||
/// <param name="key">
|
||||
/// The key.
|
||||
/// </param>
|
||||
/// <param name="values">
|
||||
/// The values.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
IRequestMatcher WithParam([NotNull] string key, params string[] values);
|
||||
|
||||
/// <summary>
|
||||
/// The with parameters.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The funcs.</param>
|
||||
/// <returns>The <see cref="IRequestMatcher"/>.</returns>
|
||||
IRequestMatcher WithParam([NotNull] params Func<IDictionary<string, WireMockList<string>>, bool>[] funcs);
|
||||
}
|
||||
}
|
||||
9
src/WireMock.Net/RequestBuilders/IRequestBuilder.cs
Normal file
9
src/WireMock.Net/RequestBuilders/IRequestBuilder.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace WireMock.RequestBuilders
|
||||
{
|
||||
/// <summary>
|
||||
/// IRequestBuilder
|
||||
/// </summary>
|
||||
public interface IRequestBuilder : IUrlAndPathRequestBuilder
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.RequestBuilders
|
||||
{
|
||||
/// <summary>
|
||||
/// IUrlAndPathRequestBuilder
|
||||
/// </summary>
|
||||
public interface IUrlAndPathRequestBuilder : IVerbRequestBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// The with url.
|
||||
/// </summary>
|
||||
/// <param name="matchers">The matchers.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
IUrlAndPathRequestBuilder WithUrl([NotNull] params IMatcher[] matchers);
|
||||
|
||||
/// <summary>
|
||||
/// The with url.
|
||||
/// </summary>
|
||||
/// <param name="urls">The urls.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
IUrlAndPathRequestBuilder WithUrl([NotNull] params string[] urls);
|
||||
|
||||
/// <summary>
|
||||
/// The with url.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The url funcs.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
IUrlAndPathRequestBuilder WithUrl([NotNull] params Func<string, bool>[] funcs);
|
||||
|
||||
/// <summary>
|
||||
/// The with path.
|
||||
/// </summary>
|
||||
/// <param name="matchers">The matchers.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
IUrlAndPathRequestBuilder WithPath([NotNull] params IMatcher[] matchers);
|
||||
|
||||
/// <summary>
|
||||
/// The with path.
|
||||
/// </summary>
|
||||
/// <param name="paths">The paths.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
IUrlAndPathRequestBuilder WithPath([NotNull] params string[] paths);
|
||||
|
||||
/// <summary>
|
||||
/// The with path.
|
||||
/// </summary>
|
||||
/// <param name="func">The path func.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
IUrlAndPathRequestBuilder WithPath([NotNull] params Func<string, bool>[] func);
|
||||
}
|
||||
}
|
||||
65
src/WireMock.Net/RequestBuilders/IVerbRequestBuilder.cs
Normal file
65
src/WireMock.Net/RequestBuilders/IVerbRequestBuilder.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace WireMock.RequestBuilders
|
||||
{
|
||||
/// <summary>
|
||||
/// The VerbRequestBuilder interface.
|
||||
/// </summary>
|
||||
public interface IVerbRequestBuilder : IHeadersAndCookiesRequestBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// The using get.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
IHeadersAndCookiesRequestBuilder UsingGet();
|
||||
|
||||
/// <summary>
|
||||
/// The using post.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
IHeadersAndCookiesRequestBuilder UsingPost();
|
||||
|
||||
/// <summary>
|
||||
/// The using delete.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
IHeadersAndCookiesRequestBuilder UsingDelete();
|
||||
|
||||
/// <summary>
|
||||
/// The using put.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
IHeadersAndCookiesRequestBuilder UsingPut();
|
||||
|
||||
/// <summary>
|
||||
/// The using head.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
IHeadersAndCookiesRequestBuilder UsingHead();
|
||||
|
||||
/// <summary>
|
||||
/// The using any verb.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
IHeadersAndCookiesRequestBuilder UsingAnyVerb();
|
||||
|
||||
/// <summary>
|
||||
/// The using verb.
|
||||
/// </summary>
|
||||
/// <param name="verbs">The verb.</param>
|
||||
/// <returns>The <see cref="IHeadersAndCookiesRequestBuilder"/>.</returns>
|
||||
IHeadersAndCookiesRequestBuilder UsingVerb([NotNull] params string[] verbs);
|
||||
}
|
||||
}
|
||||
360
src/WireMock.Net/RequestBuilders/Request.cs
Normal file
360
src/WireMock.Net/RequestBuilders/Request.cs
Normal file
@@ -0,0 +1,360 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Util;
|
||||
|
||||
namespace WireMock.RequestBuilders
|
||||
{
|
||||
/// <summary>
|
||||
/// The requests.
|
||||
/// </summary>
|
||||
public class Request : RequestMessageCompositeMatcher, IRequestBuilder
|
||||
{
|
||||
private readonly IList<IRequestMatcher> _requestMatchers;
|
||||
|
||||
/// <summary>
|
||||
/// Creates this instance.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="IRequestBuilder"/>.</returns>
|
||||
public static IRequestBuilder Create()
|
||||
{
|
||||
return new Request(new List<IRequestMatcher>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Request"/> class.
|
||||
/// </summary>
|
||||
/// <param name="requestMatchers">The request matchers.</param>
|
||||
private Request(IList<IRequestMatcher> requestMatchers) : base(requestMatchers)
|
||||
{
|
||||
_requestMatchers = requestMatchers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the request message matchers.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of IRequestMatcher</typeparam>
|
||||
/// <returns>A List{T}</returns>
|
||||
public IList<T> GetRequestMessageMatchers<T>() where T : IRequestMatcher
|
||||
{
|
||||
return new ReadOnlyCollection<T>(_requestMatchers.Where(rm => rm is T).Cast<T>().ToList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the request message matcher.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of IRequestMatcher</typeparam>
|
||||
/// <returns>A RequestMatcher</returns>
|
||||
public T GetRequestMessageMatcher<T>() where T : IRequestMatcher
|
||||
{
|
||||
return _requestMatchers.Where(rm => rm is T).Cast<T>().FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with url.
|
||||
/// </summary>
|
||||
/// <param name="matchers">The matchers.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
public IUrlAndPathRequestBuilder WithUrl(params IMatcher[] matchers)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageUrlMatcher(matchers));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with url.
|
||||
/// </summary>
|
||||
/// <param name="urls">The urls.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
public IUrlAndPathRequestBuilder WithUrl(params string[] urls)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageUrlMatcher(urls));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with url.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The url func.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
public IUrlAndPathRequestBuilder WithUrl(params Func<string, bool>[] funcs)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageUrlMatcher(funcs));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with url.
|
||||
/// </summary>
|
||||
/// <param name="matcher">The matcher.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
public IUrlAndPathRequestBuilder WithPath(params IMatcher[] matcher)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessagePathMatcher(matcher));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with path.
|
||||
/// </summary>
|
||||
/// <param name="paths">The path.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
public IUrlAndPathRequestBuilder WithPath(params string[] paths)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessagePathMatcher(paths));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with path.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The path func.</param>
|
||||
/// <returns>The <see cref="IUrlAndPathRequestBuilder"/>.</returns>
|
||||
public IUrlAndPathRequestBuilder WithPath(params Func<string, bool>[] funcs)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessagePathMatcher(funcs));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The using get.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
public IHeadersAndCookiesRequestBuilder UsingGet()
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageVerbMatcher("get"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The using post.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
public IHeadersAndCookiesRequestBuilder UsingPost()
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageVerbMatcher("post"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The using put.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
public IHeadersAndCookiesRequestBuilder UsingPut()
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageVerbMatcher("put"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The using delete.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
public IHeadersAndCookiesRequestBuilder UsingDelete()
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageVerbMatcher("delete"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The using head.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
public IHeadersAndCookiesRequestBuilder UsingHead()
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageVerbMatcher("head"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The using any verb.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The <see cref="IHeadersAndCookiesRequestBuilder"/>.
|
||||
/// </returns>
|
||||
public IHeadersAndCookiesRequestBuilder UsingAnyVerb()
|
||||
{
|
||||
var matchers = _requestMatchers.Where(m => m is RequestMessageVerbMatcher).ToList();
|
||||
foreach (var matcher in matchers)
|
||||
{
|
||||
_requestMatchers.Remove(matcher);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The using verb.
|
||||
/// </summary>
|
||||
/// <param name="verbs">The verbs.</param>
|
||||
/// <returns>The <see cref="IHeadersAndCookiesRequestBuilder"/>.</returns>
|
||||
public IHeadersAndCookiesRequestBuilder UsingVerb(params string[] verbs)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageVerbMatcher(verbs));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with body.
|
||||
/// </summary>
|
||||
/// <param name="body">
|
||||
/// The body.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
public IRequestMatcher WithBody(string body)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageBodyMatcher(body));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with body byte[].
|
||||
/// </summary>
|
||||
/// <param name="body">
|
||||
/// The body as byte[].
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
public IRequestMatcher WithBody(byte[] body)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageBodyMatcher(body));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with body.
|
||||
/// </summary>
|
||||
/// <param name="func">
|
||||
/// The body function.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
public IRequestMatcher WithBody(Func<string, bool> func)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageBodyMatcher(func));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with body.
|
||||
/// </summary>
|
||||
/// <param name="func">
|
||||
/// The body function.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
public IRequestMatcher WithBody(Func<byte[], bool> func)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageBodyMatcher(func));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with body.
|
||||
/// </summary>
|
||||
/// <param name="matcher">The matcher.</param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher" />.
|
||||
/// </returns>
|
||||
public IRequestMatcher WithBody(IMatcher matcher)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageBodyMatcher(matcher));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with parameters.
|
||||
/// </summary>
|
||||
/// <param name="key">
|
||||
/// The key.
|
||||
/// </param>
|
||||
/// <param name="values">
|
||||
/// The values.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="IRequestMatcher"/>.
|
||||
/// </returns>
|
||||
public IRequestMatcher WithParam(string key, params string[] values)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageParamMatcher(key, values.ToList()));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The with parameters.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The funcs.</param>
|
||||
/// <returns>The <see cref="IRequestMatcher"/>.</returns>
|
||||
public IRequestMatcher WithParam(params Func<IDictionary<string, WireMockList<string>>, bool>[] funcs)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageParamMatcher(funcs));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// With header.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="pattern">The pattern.</param>
|
||||
/// <param name="ignoreCase">if set to <c>true</c> [ignore case].</param>
|
||||
/// <returns></returns>
|
||||
public IHeadersAndCookiesRequestBuilder WithHeader(string name, string pattern, bool ignoreCase = true)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageHeaderMatcher(name, pattern, ignoreCase));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// With header.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The funcs.</param>
|
||||
/// <returns></returns>
|
||||
public IHeadersAndCookiesRequestBuilder WithHeader(params Func<IDictionary<string, string>, bool>[] funcs)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageHeaderMatcher(funcs));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// With cookie.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="pattern">The pattern.</param>
|
||||
/// <param name="ignoreCase">if set to <c>true</c> [ignore case].</param>
|
||||
/// <returns></returns>
|
||||
public IHeadersAndCookiesRequestBuilder WithCookie(string name, string pattern, bool ignoreCase = true)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageCookieMatcher(name, pattern, ignoreCase));
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// With header.
|
||||
/// </summary>
|
||||
/// <param name="funcs">The funcs.</param>
|
||||
/// <returns></returns>
|
||||
public IHeadersAndCookiesRequestBuilder WithCookie(params Func<IDictionary<string, string>, bool>[] funcs)
|
||||
{
|
||||
_requestMatchers.Add(new RequestMessageCookieMatcher(funcs));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user