private IScanner CreateScanner(IConfigItem config)
        {
            IScanPreprocessor      preprocessor = CreateScanPreprocessor();
            IHashProvider <string> hashProvider = CreateHashProvider();

            string scannerNamespace = typeof(IScanner).Namespace;

            Type[] scannerTypes = config.Scanners
                                  .Select(scannerName => $"{scannerNamespace}.{scannerName}Scanner")
                                  .Select(scannerType => Type.GetType(scannerType))
                                  .ToArray();

            IScanner[] scanners = scannerTypes
                                  .Select(scannerType => (IScanner)Activator.CreateInstance(scannerType, config, preprocessor, hashProvider))
                                  .ToArray();

            if (scanners.Length > 1)
            {
                CompositeScanner compositeScanner = new CompositeScanner();

                foreach (IScanner scanner in scanners)
                {
                    compositeScanner.AddScanner(scanner);
                }

                return(compositeScanner);
            }

            if (scanners.Length == 1)
            {
                return(scanners.First());
            }

            throw new ArgumentOutOfRangeException(nameof(config.Scanners));
        }
        public void ScanTest(IScanner[] scanners, ScanResult[] expectedResult)
        {
            CompositeScanner compositeScanner = new CompositeScanner();

            foreach (IScanner scanner in scanners)
            {
                compositeScanner.AddScanner(scanner);
            }

            compositeScanner.Scan();

            IReadOnlyCollection <ScanResult> results = compositeScanner.GetResult();

            results.ShouldAllBeEquivalentTo(expectedResult);
        }
        public void AppendLineTest(IScanner[] scanners, string line)
        {
            CompositeScanner compositeScanner = new CompositeScanner();

            foreach (IScanner scanner in scanners)
            {
                compositeScanner.AddScanner(scanner);
            }

            compositeScanner.AppendLine(line);

            foreach (IScanner scanner in scanners)
            {
                scanner.Received(1).AppendLine(line);
            }
        }