Add Func<> matchhing. Solves issue #2

This commit is contained in:
Stef Heyenrath
2017-01-18 20:45:38 +01:00
parent 9d1fd8fd51
commit 65c17ff519
16 changed files with 321 additions and 118 deletions

View File

@@ -86,7 +86,7 @@ namespace WireMock.Net.Tests
Check.That(_server.RequestLogs).HasSize(1);
var requestLogged = _server.RequestLogs.First();
Check.That(requestLogged.Verb).IsEqualTo("get");
Check.That(requestLogged.Body).IsEmpty();
Check.That(requestLogged.Body).IsNull();
}
[Test]

View File

@@ -265,6 +265,19 @@ namespace WireMock.Net.Tests
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
}
[Test]
public void Should_specify_requests_matching_given_params_func()
{
// given
var spec = Request.WithPath("/foo").WithParam(p => p.ContainsKey("bar") && (p["bar"].Contains("1") || p["bar"].Contains("2")));
// when
var request = new RequestMessage("/foo", "bar=1&bar=2", "Get", "Hello world!", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
}
[Test]
public void Should_exclude_requests_not_matching_given_params()
{