Ejemplo n.º 1
0
        private void MarkInputFilesAsExcluded(FolderComposite root, List <string> pathsToExclude, string projectUnderTestPath)
        {
            var allFiles = root.GetAllFiles().ToList();

            foreach (var path in pathsToExclude)
            {
                var fullPath = path.StartsWith(projectUnderTestPath) ? path : Path.GetFullPath(projectUnderTestPath + path);
                if (!Path.HasExtension(path))
                {
                    _logger.LogDebug("Scanning dir {0} for files to exclude.", fullPath);
                }
                var filesToExclude = allFiles.Where(x => x.FullPath.StartsWith(fullPath)).ToList();
                if (filesToExclude.Count() == 0)
                {
                    _logger.LogWarning("No file to exclude was found for path {0}. Did you mean to exclude another file?", fullPath);
                }
                foreach (var file in filesToExclude)
                {
                    _logger.LogDebug("File {0} will be excluded from mutation.", file.FullPath);
                    file.IsExcluded = true;
                }
            }

            var excludedCount = allFiles.Where(x => x.IsExcluded).Count();

            if (excludedCount > 0)
            {
                _logger.LogInformation("Your settings have excluded {0} files from mutation", excludedCount);
            }
        }