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