mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 08:48:28 +02:00
ct
This commit is contained in:
@@ -10,6 +10,8 @@ namespace WireMock.Net.Tests.Matchers;
|
||||
|
||||
public class FormUrlEncodedMatcherTest
|
||||
{
|
||||
private readonly CancellationToken _ct = TestContext.Current.CancellationToken;
|
||||
|
||||
[Theory]
|
||||
[InlineData("*=*")]
|
||||
[InlineData("name=John Doe")]
|
||||
@@ -25,12 +27,12 @@ public class FormUrlEncodedMatcherTest
|
||||
public async Task FormUrlEncodedMatcher_IsMatch(params string[] patterns)
|
||||
{
|
||||
// Arrange
|
||||
var content = new FormUrlEncodedContent(new[]
|
||||
{
|
||||
var content = new FormUrlEncodedContent(
|
||||
[
|
||||
new KeyValuePair<string, string>("name", "John Doe"),
|
||||
new KeyValuePair<string, string>("email", "johndoe@example.com")
|
||||
});
|
||||
var contentAsString = await content.ReadAsStringAsync();
|
||||
]);
|
||||
var contentAsString = await content.ReadAsStringAsync(_ct);
|
||||
|
||||
var matcher = new FormUrlEncodedMatcher(patterns.Select(p => new AnyOf<string, StringPattern>(p)).ToArray());
|
||||
|
||||
@@ -56,12 +58,12 @@ public class FormUrlEncodedMatcherTest
|
||||
public async Task FormUrlEncodedMatcher_IsMatch_And(bool expected, params string[] patterns)
|
||||
{
|
||||
// Arrange
|
||||
var content = new FormUrlEncodedContent(new[]
|
||||
{
|
||||
var content = new FormUrlEncodedContent(
|
||||
[
|
||||
new KeyValuePair<string, string>("name", "John Doe"),
|
||||
new KeyValuePair<string, string>("email", "johndoe@example.com")
|
||||
});
|
||||
var contentAsString = await content.ReadAsStringAsync();
|
||||
]);
|
||||
var contentAsString = await content.ReadAsStringAsync(_ct);
|
||||
|
||||
var matcher = new FormUrlEncodedMatcher(patterns.Select(p => new AnyOf<string, StringPattern>(p)).ToArray(), true, MatchOperator.And);
|
||||
|
||||
@@ -76,12 +78,12 @@ public class FormUrlEncodedMatcherTest
|
||||
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
var content = new FormUrlEncodedContent(new[]
|
||||
{
|
||||
var content = new FormUrlEncodedContent(
|
||||
[
|
||||
new KeyValuePair<string, string>("name", "John Doe"),
|
||||
new KeyValuePair<string, string>("email", "johndoe@example.com")
|
||||
});
|
||||
var contentAsString = await content.ReadAsStringAsync();
|
||||
]);
|
||||
var contentAsString = await content.ReadAsStringAsync(_ct);
|
||||
|
||||
// The expectation is that the matcher requires all properties to be present in the content.
|
||||
var matcher = new FormUrlEncodedMatcher(["name=*", "email=*", "required=*"], matchOperator: MatchOperator.And);
|
||||
|
||||
Reference in New Issue
Block a user