0

I am writing a unit test for a method. In this method a method of the EventsApi with a similar signature is called:


Task<EventCollection?> GetEvents(DateTime? createdFrom = null, DateTime? createdTo = null, string? source = null, string? type = null);

And I would like to make sure, that the method is called with a specified source. How to do it, what to put here?

eventsApi.Verify(x => x.GetEvents(<what_to_put_here?>));
Ivajlo Iliev
  • 303
  • 1
  • 3
  • 19
  • 1
    `eventsApi.Verify(x => x.GetEvents( source: "123abc" ));` – Dai Oct 07 '22 at 14:06
  • 1
    In case you are using Moq, you may pass the other arguments as It.IsAny<>. `eventsApi.Verify(x => x.GetEvents(It.IsAny(), It.IsAny(), "The Specic Source", It.IsAny()));` – Behnam Oct 07 '22 at 14:13

0 Answers0