Пример #1
0
        public void OnAllMutantsTested(IReadOnlyProjectComponent reportComponent)
        {
            var files = new List <ReadOnlyFileLeaf>();

            ReadOnlyFolderComposite rootFolder = null;

            reportComponent.DisplayFolder = (IReadOnlyProjectComponent current) =>
            {
                rootFolder ??= (ReadOnlyFolderComposite)current;
            };

            reportComponent.DisplayFile = (IReadOnlyProjectComponent current) =>
            {
                files.Add((ReadOnlyFileLeaf)current);
            };

            // print empty line for readability
            _consoleWriter.WriteLine();
            _consoleWriter.WriteLine();
            _consoleWriter.WriteLine("All mutants have been tested, and your mutation score has been calculated");

            // start recursive invocation of handlers
            reportComponent.Display();

            var filePathLength = Math.Max(9, files.Max(f => f.RelativePath?.Length ?? 0) + 1);

            _consoleWriter.WriteLine($"┌─{new string('─', filePathLength)}┬──────────┬──────────┬───────────┬────────────┬──────────┬─────────┐");
            _consoleWriter.WriteLine($"│ File{new string(' ', filePathLength - 4)}│  % score │ # killed │ # timeout │ # survived │ # no cov │ # error │");
            _consoleWriter.WriteLine($"├─{new string('─', filePathLength)}┼──────────┼──────────┼───────────┼────────────┼──────────┼─────────┤");

            DisplayComponent(rootFolder, filePathLength);

            foreach (var file in files)
            {
                DisplayComponent(file, filePathLength);
            }

            _consoleWriter.WriteLine($"└─{new string('─', filePathLength)}┴──────────┴──────────┴───────────┴────────────┴──────────┴─────────┘");
        }
Пример #2
0
        private IDictionary <string, JsonReportFileComponent> GenerateFolderReportComponents(ReadOnlyFolderComposite folderComponent)
        {
            var files = new Dictionary <string, JsonReportFileComponent>();

            foreach (var child in folderComponent.Children)
            {
                Merge(files, GenerateReportComponents(child));
            }

            return(files);
        }