public void RequestMessageHeaderMatcher_GetMatchingScore_RejectOnMatch_HeaderDoesNotExists() { // Assign var requestMessage = new RequestMessage(new UrlDetails("http://localhost"), "GET", "127.0.0.1"); var matcher = new RequestMessageHeaderMatcher(MatchBehaviour.RejectOnMatch, "h", "x", true); // Act var result = new RequestMatchResult(); double score = matcher.GetMatchingScore(requestMessage, result); // Assert Check.That(score).IsEqualTo(1.0d); }
public void RequestMessageHeaderMatcher_GetMatchingScore_RejectOnMatch() { // Assign var headers = new Dictionary <string, string[]> { { "h", new[] { "x" } } }; var requestMessage = new RequestMessage(new UrlDetails("http://localhost"), "GET", "127.0.0.1", null, headers); var matcher = new RequestMessageHeaderMatcher(MatchBehaviour.RejectOnMatch, "h", "x", true); // Act var result = new RequestMatchResult(); double score = matcher.GetMatchingScore(requestMessage, result); // Assert Check.That(score).IsEqualTo(0.0d); }
public void RequestMessageHeaderMatcher_GetMatchingScore_Func_Match() { // Assign var headers = new Dictionary <string, string[]> { { "h", new[] { "x" } } }; var requestMessage = new RequestMessage(new UrlDetails("http://localhost"), "GET", "127.0.0.1", null, headers); var matcher = new RequestMessageHeaderMatcher(x => x.ContainsKey("h")); // Act var result = new RequestMatchResult(); double score = matcher.GetMatchingScore(requestMessage, result); // Assert Check.That(score).IsEqualTo(1.0d); }