title: How to unit test the void method which puts a message to azure service bus using AzureClientFactory
body: <p>We have a method to submit message to azure service bus which returns void. Since the SendMessageAsync is not returning any response after putting the message to the Azure Queue, I'm not sure whether we need to  unit test this method.
  We are using xUnit and Moq for the test and the project is .Net 6
  Please let us know your thoughts as well.
  This is the method that needs to be tested.</p>
  <pre><code>private readonly IConfiguration _configuration;
  private readonly ILogger&lt;QueueService&gt; _logger;
  private readonly IAzureClientFactory&lt;ServiceBusClient&gt; _azureClientFactory;
  
  public AzureBusService(IConfiguration configuration,
   ILogger&lt;QueueService&gt; logger, 
   IAzureClientFactory&lt;ServiceBusClient&gt; azureClientFactory)
  {
      _configuration = configuration;
      _logger = logger;
      _azureClientFactory = azureClientFactory;
  }
  
  public async Task SendMessage(string message)
  {
      try
      {
          var serviceBusCLient = _azureClientFactory.CreateClient(&quot;AzureSB&quot;);
          var serviceBusSender = serviceBusCLient.CreateSender(&quot;queue1&quot;);
          var serviceBusMessage = new ServiceBusMessage(message);
              await serviceBusSender.SendMessageAsync(serviceBusMessage);
      }
      catch (Exception ex)
      {
          _logger.LogError(&quot;ex.Message}&quot;);
          throw new Exception($&quot;sendmessage failed&quot;);
      }
  }
  </code></pre>