C
C#3y ago
shivam51

❔ How can I mock a Service class being used in Component class?

The service also initializes a dapr component in it's constructor. I want to unit test a function of the controller class. Happy to share more info.
4 Replies
becquerel
becquerel3y ago
does the component depend against the service class directly, or against an interface that the service implements? typically you mock interfaces
Accord
Accord3y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
shivam51
shivam51OP3y ago
This is correct. I am mocking the interface now.
Accord
Accord3y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?