mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-19 00:27:04 +01:00
RejectOnMatch (wip)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
https://github.com/GitTools/GitReleaseNotes
|
||||
|
||||
GitReleaseNotes.exe . /OutputFile CHANGELOG.md /Version 1.0.3.16
|
||||
GitReleaseNotes.exe . /OutputFile CHANGELOG.md /Version 1.0.3.17
|
||||
|
||||
GitReleaseNotes.exe . /OutputFile CHANGELOG.md /allTags
|
||||
|
||||
@@ -153,6 +153,7 @@ namespace WireMock.Net.ConsoleApplication
|
||||
server
|
||||
.Given(Request.Create()
|
||||
.WithPath("/reject")
|
||||
.UsingGet()
|
||||
.WithHeader("x", "1", MatchBehaviour.RejectOnMatch)
|
||||
.UsingAnyMethod())
|
||||
.RespondWith(Response.Create()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Description>Lightweight StandAlone Http Mocking Server for .Net.</Description>
|
||||
<AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle>
|
||||
<Version>1.0.3.16</Version>
|
||||
<Version>1.0.3.17</Version>
|
||||
<Authors>Stef Heyenrath</Authors>
|
||||
<TargetFrameworks>net452;net46;netstandard1.3;netstandard2.0</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace WireMock.Matchers
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IMatcher.Name"/>
|
||||
public string Name => "RegexMatcher";
|
||||
public virtual string Name => "RegexMatcher";
|
||||
|
||||
/// <inheritdoc cref="IIgnoreCaseMatcher.IgnoreCase"/>
|
||||
public bool IgnoreCase { get; }
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace WireMock.Matchers.Request
|
||||
Check.NotNull(name, nameof(name));
|
||||
Check.NotNull(patterns, nameof(patterns));
|
||||
|
||||
_matchBehaviour = matchBehaviour;
|
||||
Name = name;
|
||||
Matchers = patterns.Select(pattern => new WildcardMatcher(matchBehaviour, pattern, ignoreCase)).Cast<IStringMatcher>().ToArray();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,6 @@ namespace WireMock.Matchers
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IMatcher.Name"/>
|
||||
public new string Name => "WildcardMatcher";
|
||||
public override string Name => "WildcardMatcher";
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
|
||||
<AssemblyTitle>WireMock.Net</AssemblyTitle>
|
||||
<Version>1.0.3.16</Version>
|
||||
<Version>1.0.3.17</Version>
|
||||
<Authors>Stef Heyenrath</Authors>
|
||||
<TargetFrameworks>net452;net46;netstandard1.3;netstandard2.0</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
||||
@@ -20,6 +20,20 @@ namespace WireMock.Net.Tests.Matchers
|
||||
Check.That(name).Equals("ExactObjectMatcher");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExactObjectMatcher_IsMatch_ByteArray()
|
||||
{
|
||||
// Assign
|
||||
object checkValue = new byte[] { 1, 2 };
|
||||
|
||||
// Act
|
||||
var matcher = new ExactObjectMatcher(new byte[] { 1, 2 });
|
||||
double result = matcher.IsMatch(checkValue);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExactObjectMatcher_IsMatch_AcceptOnMatch()
|
||||
{
|
||||
|
||||
@@ -78,10 +78,10 @@ namespace WireMock.Net.Tests.Matchers
|
||||
public void JsonPathMatcher_IsMatch_Object_Exception_Mismatch()
|
||||
{
|
||||
// Assign
|
||||
var matcher = new JsonPathMatcher("xxx");
|
||||
var matcher = new JsonPathMatcher("");
|
||||
|
||||
// Act
|
||||
double match = matcher.IsMatch("");
|
||||
double match = matcher.IsMatch("x");
|
||||
|
||||
// Assert
|
||||
Check.That(match).IsEqualTo(0);
|
||||
|
||||
@@ -32,6 +32,18 @@ namespace WireMock.Net.Tests.Matchers
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RegexMatcher_GetIgnoreCase()
|
||||
{
|
||||
// Act
|
||||
bool case1 = new RegexMatcher("X").IgnoreCase;
|
||||
bool case2 = new RegexMatcher("X", true).IgnoreCase;
|
||||
|
||||
// Assert
|
||||
Check.That(case1).IsFalse();
|
||||
Check.That(case2).IsTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RegexMatcher_IsMatch()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user