mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-19 15:31:39 +02:00
RejectOnMatch (wip)
This commit is contained in:
@@ -13,7 +13,7 @@ namespace WireMock.Net.Tests.Matchers
|
||||
var matcher = new XPathMatcher("X");
|
||||
|
||||
// Act
|
||||
string name = matcher.GetName();
|
||||
string name = matcher.Name;
|
||||
|
||||
// Assert
|
||||
Check.That(name).Equals("XPathMatcher");
|
||||
@@ -31,5 +31,39 @@ namespace WireMock.Net.Tests.Matchers
|
||||
// Assert
|
||||
Check.That(patterns).ContainsExactly("X");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void XPathMatcher_IsMatch_AcceptOnMatch()
|
||||
{
|
||||
// Assign
|
||||
string xml = @"
|
||||
<todo-list>
|
||||
<todo-item id='a1'>abc</todo-item>
|
||||
</todo-list>";
|
||||
var matcher = new XPathMatcher("/todo-list[count(todo-item) = 1]");
|
||||
|
||||
// Act
|
||||
double result = matcher.IsMatch(xml);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void XPathMatcher_IsMatch_RejectOnMatch()
|
||||
{
|
||||
// Assign
|
||||
string xml = @"
|
||||
<todo-list>
|
||||
<todo-item id='a1'>abc</todo-item>
|
||||
</todo-list>";
|
||||
var matcher = new XPathMatcher(MatchBehaviour.RejectOnMatch, "/todo-list[count(todo-item) = 1]");
|
||||
|
||||
// Act
|
||||
double result = matcher.IsMatch(xml);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsEqualTo(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user