mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 17:10:26 +01:00
Initial code (copy)
This commit is contained in:
54
src/WireMock/RequestPathSpec.cs
Normal file
54
src/WireMock/RequestPathSpec.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 path spec.
|
||||
/// </summary>
|
||||
public class RequestPathSpec : ISpecifyRequests
|
||||
{
|
||||
/// <summary>
|
||||
/// The _path.
|
||||
/// </summary>
|
||||
private readonly string _path;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestPathSpec"/> class.
|
||||
/// </summary>
|
||||
/// <param name="path">
|
||||
/// The path.
|
||||
/// </param>
|
||||
public RequestPathSpec(string path)
|
||||
{
|
||||
_path = path;
|
||||
}
|
||||
|
||||
/// <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(_path, request.Path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user