Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormUrlEncodedMatcher is not requiring to match all properties when MatchOperator.And #1156

Closed
luheorga opened this issue Aug 14, 2024 · 2 comments
Assignees
Labels

Comments

@luheorga
Copy link

luheorga commented Aug 14, 2024

Hi, I'm using the FormUrlEncodedMatcher and realized that it is not requiring all the patterns configured to match when MatchOperator.And

Expected behavior:

When FormUrlEncodedMatcher is configured with MatchOperator.And should match all the patterns configured

Test to reproduce

[Fact]
public async Task FormUrlEncodedMatcher_IsMatch_And_MatchAllProperties()
{
    // Arrange
    var content = new FormUrlEncodedContent(new[]
    {
        new KeyValuePair<string, string>("name", "John Doe"),
        new KeyValuePair<string, string>("email", "[email protected]")
    });
    var contentAsString = await content.ReadAsStringAsync();

    // 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);

    // Act
    var score = matcher.IsMatch(contentAsString).IsPerfect();

    // Assert
    score.Should().BeFalse();
}
@luheorga luheorga added the bug label Aug 14, 2024
@StefH StefH self-assigned this Aug 15, 2024
@StefH
Copy link
Collaborator

StefH commented Aug 15, 2024

#1157

@StefH StefH closed this as completed Aug 15, 2024
@luheorga
Copy link
Author

Hi @StefH, thank you for the celerity on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants