How to mock the constructor using xunit if I have the following service :
public class MyService : IMyService
{
private readonly IPublisher _publisher;
public MyService (IRabbitMQFactory mqFactory)
{
_publisher = mqFactory.GetScopedPublisher(
new Tools.RabbitMq.Nuget.Parameters.ExchangeParameters
(
name: "MyService",
type: ERabbitMqExchangeType.DIRECT
));
}
// ...
}
I would like create UT for a service that publish message with RabbitMqFactory.