Hello @Ershad Nozari I am afraid, you can not mock that directly as PublishEventsAsync is an extension method of IEventGridClient, but you should be able to mock the method PublishEventsWithHttpMessages of IEventGridClient.
Please refer to: https://video2.skills-academy.com/dotnet/api/microsoft.azure.eventgrid.ieventgridclient.publisheventswithhttpmessagesasync
In short, if you mock PublishEventsWithHttpMessagesAsync, the extension method PublishEventsAsync will be taken care since internally PublishEventsAsync calls PublishEventsWithHttpMessagesAsync internally. Your actual code still can use PublishEventsAsync, it's just mocking trick in your unit test.
client.Setup(x
=> x.PublishEventsWithHttpMessagesAsync(It.IsAny<string>(),
It.IsAny<IList<EventGridEvent>>(),
It.IsAny<Dictionary<List<string>>>(),
It.IsAny<CancellationToken >()))
.ReturnsAsync(new AzureOperationResponse());
Please let me know if this helps.