skip to Main Content

Asp.net – How to mock dependency of service that has fuction with argument in type of 'async Function'?

I have a function here that is for getting the logs in the queue. How can I mock this function for unit testing ? void QueueBackgroundWorkItem(Func<CancellationToken, IServiceProvider, Task> workItem); Mock<IBackgroundTaskQueue> _Mock= new Mock<IBackgroundTaskQueue>(); _Mock.Setup(x=>x.QueueBackgroundWorkItem(?)).Returns(Task.CompletedTask); Thank you.

VIEW QUESTION

Xunit in asp.net core

I'm new at asp.net and moq and xunit test, I want to create a test case for my asp.net project. I have the service file that is CRUD action, I have been written for Create Method it's Ok but at…

VIEW QUESTION
Back To Top
Search