mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-25 19:02:24 +01:00
Initial code (copy)
This commit is contained in:
54
src/WireMock/RequestUrlSpec.cs
Normal file
54
src/WireMock/RequestUrlSpec.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[module:
|
||||
SuppressMessage("StyleCop.CSharp.ReadabilityRules",
|
||||
"SA1101:PrefixLocalCallsWithThis",
|
||||
Justification = "Reviewed. Suppression is OK here, as it conflicts with internal naming rules.")]
|
||||
[module:
|
||||
SuppressMessage("StyleCop.CSharp.NamingRules",
|
||||
"SA1309:FieldNamesMustNotBeginWithUnderscore",
|
||||
Justification = "Reviewed. Suppression is OK here, as it conflicts with internal naming rules.")]
|
||||
[module:
|
||||
SuppressMessage("StyleCop.CSharp.DocumentationRules",
|
||||
"SA1633:FileMustHaveHeader",
|
||||
Justification = "Reviewed. Suppression is OK here, as unknown copyright and company.")]
|
||||
// ReSharper disable ArrangeThisQualifier
|
||||
// ReSharper disable InconsistentNaming
|
||||
namespace WireMock
|
||||
{
|
||||
/// <summary>
|
||||
/// The request url spec.
|
||||
/// </summary>
|
||||
public class RequestUrlSpec : ISpecifyRequests
|
||||
{
|
||||
/// <summary>
|
||||
/// The _url.
|
||||
/// </summary>
|
||||
private readonly string _url;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestUrlSpec"/> class.
|
||||
/// </summary>
|
||||
/// <param name="url">
|
||||
/// The url.
|
||||
/// </param>
|
||||
public RequestUrlSpec(string url)
|
||||
{
|
||||
_url = url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The is satisfied by.
|
||||
/// </summary>
|
||||
/// <param name="request">
|
||||
/// The request.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The <see cref="bool"/>.
|
||||
/// </returns>
|
||||
public bool IsSatisfiedBy(Request request)
|
||||
{
|
||||
return WildcardPatternMatcher.MatchWildcardString(_url, request.Url);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user