Ejemplo n.º 1
0
        public void OnAllMutantsTested(IReadOnlyProjectComponent reportComponent)
        {
            var files = reportComponent.GetAllFiles();

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

                var    filePathLength = Math.Max(9, files.Max(f => f.RelativePath?.Length ?? 0) + 1);
                string dashes         = new string('─', filePathLength);
                _consoleWriter.WriteLine($"┌─{dashes}┬──────────┬──────────┬───────────┬────────────┬──────────┬─────────┐");
                _consoleWriter.WriteLine($"│ File{new string(' ', filePathLength - 4)}│  % score │ # killed │ # timeout │ # survived │ # no cov │ # error │");
                _consoleWriter.WriteLine($"├─{dashes}┼──────────┼──────────┼───────────┼────────────┼──────────┼─────────┤");

                DisplayComponent(reportComponent, filePathLength);

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

                _consoleWriter.WriteLine($"└─{dashes}┴──────────┴──────────┴───────────┴────────────┴──────────┴─────────┘");
            }
        }
        public void OnAllMutantsTested(IReadOnlyProjectComponent reportComponent)
        {
            var files = reportComponent.GetAllFiles();

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

                var table = new Table()
                            .RoundedBorder()
                            .AddColumn("File", c => c.NoWrap())
                            .AddColumn("% score", c => c.Alignment(Justify.Right).NoWrap())
                            .AddColumn("# killed", c => c.Alignment(Justify.Right).NoWrap())
                            .AddColumn("# timeout", c => c.Alignment(Justify.Right).NoWrap())
                            .AddColumn("# survived", c => c.Alignment(Justify.Right).NoWrap())
                            .AddColumn("# no cov", c => c.Alignment(Justify.Right).NoWrap())
                            .AddColumn("# error", c => c.Alignment(Justify.Right).NoWrap());

                DisplayComponent(reportComponent, table);

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

                _console.Write(table);
            }
        }