public async Task DisposeTest()
        {
            var restOpMock = new Mock <IHttpClientHelper>();

            restOpMock.Setup(restOp => restOp.Dispose());
            var connectionClosed = false;
            Func <TimeSpan, Task <AmqpSession> > onCreate = _ => Task.FromResult(new AmqpSession(null, new AmqpSessionSettings(), null));
            Action <AmqpSession> onClose = _ => { connectionClosed = true; };
            // Instantiate AmqpServiceClient with Mock IHttpClientHelper and IotHubConnection
            var connection    = new IotHubConnection(onCreate, onClose);
            var serviceClient = new AmqpServiceClient(connection, restOpMock.Object);
            // This is required to cause onClose callback invocation.
            await connection.OpenAsync(TimeSpan.FromSeconds(1)).ConfigureAwait(false);

            serviceClient.Dispose();
            restOpMock.Verify(restOp => restOp.Dispose(), Times.Once());
            Assert.IsTrue(connectionClosed);
        }