public void SetUp() { _mongoDbRunner = MongoDbRunner.Start(additionalMongodArguments: "--quiet"); var connection = new MongoClient(_mongoDbRunner.ConnectionString); var database = connection.GetDatabase("Test"); var gridFsBucket = new GridFSBucket(database); _scanBackendService = new Mock <IScanBackendService>(); _scanBackendService .SetupGet(x => x.List) .Returns(() => new[] { new ScanBackend { Id = "dummy", Enabled = true }, new ScanBackend { Id = "clamav", Enabled = true }, new ScanBackend { Id = "disabled", Enabled = false } }); _resultService = new ScanResultService( database, gridFsBucket, _scanBackendService.Object); }
/// <summary> /// Initialize receiver hosted service. /// </summary> /// <param name="bus">EasyNetQ bus.</param> /// <param name="configuration">Configuration.</param> /// <param name="scanResultService">Scan result service.</param> /// <param name="logger">Logger.</param> public ReceiverHostedService(IBus bus, IConfiguration configuration, IScanResultService scanResultService, ILogger <ReceiverHostedService> logger) { _bus = bus; _configuration = configuration; _scanResultService = scanResultService; _logger = logger; }
/// <summary> /// Initialize receiver hosted service. /// </summary> /// <param name="bus">EasyNetQ bus.</param> /// <param name="configuration">Configuration.</param> /// <param name="scanResultService">Scan result service.</param> /// <param name="logger">Logger.</param> /// <param name="httpClientFactory">HTTP client factory.</param> public ReceiverHostedService(IBus bus, IConfiguration configuration, IScanResultService scanResultService, ILogger <ReceiverHostedService> logger, IHttpClientFactory httpClientFactory) { _bus = bus; _configuration = configuration; _scanResultService = scanResultService; _logger = logger; _httpClientFactory = httpClientFactory; }
/// <summary> /// Initialize scan result storing job. /// </summary> /// <param name="logger">Logger.</param> /// <param name="httpClientFactory">HTTP client factory.</param> /// <param name="scanResultService">Scan result service.</param> /// <param name="backgroundJobClient">Background job client.</param> public ScanResultJob( ILogger <ScanResultJob> logger, IHttpClientFactory httpClientFactory, IScanResultService scanResultService, IBackgroundJobClient backgroundJobClient) { _logger = logger; _httpClientFactory = httpClientFactory; _scanResultService = scanResultService; _backgroundJobClient = backgroundJobClient; }
public void SetUp() { _mongoDbRunner = MongoDbRunner.Start(additionalMongodArguments: "--quiet"); var connection = new MongoClient(_mongoDbRunner.ConnectionString); var database = connection.GetDatabase("Test"); var gridFsBucket = new GridFSBucket(database); _resultService = new ScanResultService( database, gridFsBucket, Mock.Of <IConsulClient>(), Mock.Of <IBackgroundJobClient>()); }
/// <summary> /// Initialize scan results controller. /// </summary> /// <param name="scanResultService">Scan result service.</param> public ScanResultsController(IScanResultService scanResultService) { _scanResultService = scanResultService; }
/// <summary> /// Initialize downloads controller. /// </summary> /// <param name="scanResultService">Scan result service.</param> public DownloadController(IScanResultService scanResultService) { _scanResultService = scanResultService; }
/// <summary> /// Initialize queue controller. /// </summary> /// <param name="scanResultService">Scan result service.</param> public QueueController(IScanResultService scanResultService) { _scanResultService = scanResultService; }