title: How to unit test a class which calls service bus queue client SendAsync method
body: <p>I have a interface which has a method to create instance of queue client and message factory. I have created a concrete implementation of the same and now i am trying to unit test the functionality which is used for send message to queue. I have written below code for the same:</p>
  
  <pre><code>private readonly Mock&lt;IQueueClientProvider&gt; queueClientProvider;
  
  private readonly Mock&lt;IJsonSerializer&gt; jsonSerializer;
  
  private readonly Mock&lt;ILogger&lt;QueueConnector&gt;&gt; logger;
  
  private readonly ModelLogger&lt;QueueConnector&gt; modelLogger;
  
  private readonly QueueConnector queueConnector;
  
  private readonly Mock&lt;QueueClient&gt; queueClient;
  
  public QueueConnectorTests() 
  
  {
  
     queueClientProvider = new Mock&lt; IQueueClientProvider &gt;();
  
     queueClient = new Mock&lt; QueueClient &gt;();
  
     logger = new Mock&lt; ILogger&lt; QueueConnector &gt;&gt;();
  
     jsonSerializer = new Mock&lt; IJsonSerializer &gt;();
  
     modelLogger = new ModelLogger&lt;QueueConnector&gt;(logger.Object,     jsonSerializer.Object);
  
  queueConnector = new QueueConnector(modelLogger, queueClientProvider.Object);
  
  }
  
  [Fact]
  public async void ShouldBeAbleToSendMessage()
  
  {
  
    BrokeredMessage brokeredMessage = new BrokeredMessage();
  
  brokeredMessage.CorrelationId = "0HKVUFCD6Q5JL";
  
  queueClientProvider.Setup(q =&gt;q.CreateQueueClient()).Returns(queueClient.Object);
  
  // Act
  
  await queueConnector.SendMessage(brokeredMessage);
  
  // Assert
  
   queueClient.Verify(q =&gt; q.SendAsync(brokeredMessage));
  
  
  }
  </code></pre>
  
  <p>but getting exception </p>
  
  <blockquote>
    <p>An exception of type 'System.NotSupportedException' occurred in
    mscorlib.dll but was not handled in user code</p>
    
    <p>Additional information: Parent does not have a default constructor.
    The default constructor must be explicitly defined.</p>
  </blockquote>
  
  <p>Can someone please help me with this not sure whats going wrong here?</p>