@@ -209,5 +209,79 @@ public void RequestMessageParamMatcher_With1ParamContainingComma_Using_QueryPara
209209 // Assert
210210 score . Should ( ) . Be ( 1.0 ) ;
211211 }
212- }
213212
213+ [ Fact ]
214+ public void RequestMessageParamMatcher_RejectOnMatch_WhenValuePresentMatchesPattern_ReturnsMismatch ( )
215+ {
216+ // Assign: the param value in the URL matches the reject pattern -> the mapping must be rejected (score 0.0).
217+ var requestMessage = new RequestMessage ( new UrlDetails ( "http://localhost?key=abc" ) , "GET" , "127.0.0.1" ) ;
218+ var matcher = new RequestMessageParamMatcher ( MatchBehaviour . RejectOnMatch , "key" , false , new [ ] { "abc" } ) ;
219+
220+ // Act
221+ var result = new RequestMatchResult ( ) ;
222+ var score = matcher . GetMatchingScore ( requestMessage , result ) ;
223+
224+ // Assert
225+ score . Should ( ) . Be ( 0.0d ) ;
226+ }
227+
228+ [ Fact ]
229+ public void RequestMessageParamMatcher_RejectOnMatch_WhenValuePresentDoesNotMatchPattern_ReturnsPerfect ( )
230+ {
231+ // Assign: the param value in the URL does NOT match the reject pattern -> the mapping is accepted (score 1.0).
232+ var requestMessage = new RequestMessage ( new UrlDetails ( "http://localhost?key=xyz" ) , "GET" , "127.0.0.1" ) ;
233+ var matcher = new RequestMessageParamMatcher ( MatchBehaviour . RejectOnMatch , "key" , false , new [ ] { "abc" } ) ;
234+
235+ // Act
236+ var result = new RequestMatchResult ( ) ;
237+ var score = matcher . GetMatchingScore ( requestMessage , result ) ;
238+
239+ // Assert
240+ score . Should ( ) . Be ( 1.0d ) ;
241+ }
242+
243+ [ Fact ]
244+ public void RequestMessageParamMatcher_RejectOnMatch_WithIgnoreCase_WhenValueMatchesCaseInsensitively_ReturnsMismatch ( )
245+ {
246+ // Assign: ignoreCase must still be honored on the inner matcher after the fix.
247+ var requestMessage = new RequestMessage ( new UrlDetails ( "http://localhost?key=ABC" ) , "GET" , "127.0.0.1" ) ;
248+ var matcher = new RequestMessageParamMatcher ( MatchBehaviour . RejectOnMatch , "key" , true , new [ ] { "abc" } ) ;
249+
250+ // Act
251+ var result = new RequestMatchResult ( ) ;
252+ var score = matcher . GetMatchingScore ( requestMessage , result ) ;
253+
254+ // Assert
255+ score . Should ( ) . Be ( 0.0d ) ;
256+ }
257+
258+ [ Fact ]
259+ public void RequestMessageParamMatcher_AcceptOnMatch_WhenValuePresentMatchesPattern_ReturnsPerfect ( )
260+ {
261+ // Assign
262+ var requestMessage = new RequestMessage ( new UrlDetails ( "http://localhost?key=abc" ) , "GET" , "127.0.0.1" ) ;
263+ var matcher = new RequestMessageParamMatcher ( MatchBehaviour . AcceptOnMatch , "key" , false , new [ ] { "abc" } ) ;
264+
265+ // Act
266+ var result = new RequestMatchResult ( ) ;
267+ var score = matcher . GetMatchingScore ( requestMessage , result ) ;
268+
269+ // Assert
270+ score . Should ( ) . Be ( 1.0d ) ;
271+ }
272+
273+ [ Fact ]
274+ public void RequestMessageParamMatcher_AcceptOnMatch_WhenValuePresentDoesNotMatchPattern_ReturnsMismatch ( )
275+ {
276+ // Assign
277+ var requestMessage = new RequestMessage ( new UrlDetails ( "http://localhost?key=xyz" ) , "GET" , "127.0.0.1" ) ;
278+ var matcher = new RequestMessageParamMatcher ( MatchBehaviour . AcceptOnMatch , "key" , false , new [ ] { "abc" } ) ;
279+
280+ // Act
281+ var result = new RequestMatchResult ( ) ;
282+ var score = matcher . GetMatchingScore ( requestMessage , result ) ;
283+
284+ // Assert
285+ score . Should ( ) . Be ( 0.0d ) ;
286+ }
287+ }
0 commit comments