private async Task <IEnumerable <MxHostTestDetails> > GetMxHostToProcess(object _)
        {
            List <MxHostTestDetails> hosts = new List <MxHostTestDetails>();

            try
            {
                _log.LogDebug("Getting mx hosts to process.");

                var testsPending = await _mxQueueProcessor.GetMxHosts();

                hosts.AddRange(testsPending.Select(tp => new MxHostTestDetails(tp)
                {
                    NormalizedHostname = tp.Id.Trim().TrimEnd('.').ToLowerInvariant()
                }));

                _log.LogDebug(testsPending.Count > 0
                    ? $"Found {testsPending.Count} mx hosts to test: {Environment.NewLine}{string.Join(Environment.NewLine, testsPending.Select(pendingTest => pendingTest.Id))}"
                    : "Didn't find any hosts to test.");
            }
            catch (Exception e)
            {
                _log.LogError(e, $"Error occured fetching mx hosts to test");
            }

            return(hosts);
        }
        public async Task NoProfileToProcessNoProcessingOccurs()
        {
            A.CallTo(() => _mxQueueProcessor.GetMxHosts())
            .Returns(Task.FromResult(new List <TlsTestPending>()));

            Task process = _mxSecurityTesterProcessor.Process(cancellationTokenSource.Token);

            await _pipelineStartBlock.SendAsync(null);

            cancellationTokenSource.Cancel();

            await process;

            A.CallTo(() => _mxQueueProcessor.GetMxHosts()).MustHaveHappenedOnceExactly();
            A.CallTo(() => _mxHostTester.Test(A <TlsTestPending> ._)).MustNotHaveHappened();
            A.CallTo(() => _publisher.Publish(A <Message> ._, A <string> ._)).MustNotHaveHappened();
            A.CallTo(() => _mxQueueProcessor.DeleteMessage(A <string> ._, A <string> ._)).MustNotHaveHappened();
            A.CallTo(() => _processingFilter.Reserve(A <string> ._)).MustNotHaveHappened();
            A.CallTo(() => _processingFilter.ReleaseReservation(A <string> ._)).MustNotHaveHappened();
        }