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

How to match date param to a certain date range when using the Admin Api Client #960

Closed
doddi321 opened this issue Jun 27, 2023 · 3 comments
Assignees
Labels

Comments

@doddi321
Copy link

doddi321 commented Jun 27, 2023

I'm using Testcontainers and using the the admin client to create the mappings like so:

        await iLApi.ResetMappingsAsync();
        var mappingBuilder = iLApi.GetMappingBuilder();
        mappingBuilder.Given(m => m
            .WithRequest(req => req
                .UsingGet()
                .WithPath("/api/claimants/modified")
            )
            .WithResponse(rsp => rsp
                .WithStatusCode(StatusCodes.Status200OK)
                .WithBodyAsJson(ILModifiedClaimants)
            )
        ); 

I need to match a date query parameter to a certain date range, f.x. /api/claimants/modified?since=....

I know the LinqMatcher exists which seems fit my needs perfectly but the only thing that the .WithParams method accepts is the MatcherModel which seems to only support Regex.

Is what I am asking possible and if so how?

@StefH
Copy link
Collaborator

StefH commented Jun 27, 2023

Hello @doddi321.

Good question.

I'll take look.

@StefH StefH self-assigned this Jun 27, 2023
@StefH
Copy link
Collaborator

StefH commented Jun 27, 2023

@doddi321
It should work, example:

[
  {
    "Guid": "41372914-1838-4c67-916b-b9aacdd096ce",
    "UpdatedAt": "2023-01-14T15:16:17",
    "Request": {
      "Path": {
        "Matchers": [
          {
            "Name": "WildcardMatcher",
            "Pattern": "/foo",
            "IgnoreCase": false
          }
        ]
      },
      "Methods": [
        "GET"
      ],
      "Params": [
        {
          "Name": "test",
          "Matchers": [
            {
              "Name": "LinqMatcher",
              "Pattern": "it.Length < 10"
            }
          ]
        }
      ]
    },
    "Response": {
      "BodyDestination": "SameAsSource",
      "Body": "{ msg: \"Hello world!\"}"
    }
  }
]

@StefH StefH closed this as completed Jun 27, 2023
@StefH
Copy link
Collaborator

StefH commented Jun 27, 2023

#961

@StefH StefH added question and removed feature labels Jun 28, 2023
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