public void SetUp()
        {
            _busMock = new Mock <IBus>();

            _scanBackendMock = new Mock <IScanBackend>();

            _scanBackendMock
            .SetupGet(x => x.Id)
            .Returns("dummy");

            _scanHostedService = new ScanHostedService(
                Mock.Of <ILogger <ScanHostedService> >(),
                _scanBackendMock.Object,
                _busMock.Object);
        }
        public void SetUp()
        {
            var configuration = new ConfigurationRoot(new List <IConfigurationProvider>
            {
                new MemoryConfigurationProvider(new MemoryConfigurationSource())
            })
            {
                ["ResultsSubscriptionId"] = "mms.results"
            };

            _busMock = new Mock <IBus>();

            _busMock
            .Setup(x => x.Receive("dummy", It.IsAny <Func <ScanRequestMessage, Task> >()))
            .Callback <string, Func <ScanRequestMessage, Task> >((s, func) =>
            {
                var task = func.Invoke(new ScanRequestMessage
                {
                    Id  = "test",
                    Uri = new Uri("http://test.com")
                });

                task.Wait();
            });

            _scanBackendMock = new Mock <IScanBackend>();

            _scanBackendMock
            .Setup(x => x.ScanAsync(It.IsAny <Uri>(), It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(new[] { "Test" }));

            _scanBackendMock
            .SetupGet(x => x.Id)
            .Returns("dummy");

            _scanHostedService = new ScanHostedService(
                Mock.Of <ILogger <ScanHostedService> >(),
                _scanBackendMock.Object,
                _busMock.Object,
                configuration);
        }