Esempio n. 1
0
        public void SaveRunResults(RunResults results)
        {
            using (var conn = CreateConnection())
            {
                var sql = @"INSERT INTO
                                RunResults
                                (TestName,
                                Title,
                                YAxisLegend,
                                RanAt,
                                TimeTaken,
                                TimeTakenFormatted,
                                Error)
                            VALUES
                                (@TestName,
                                @Title,
                                @YAxisLegend,
                                @RanAt,
                                @TimeTaken,
                                @TimeTakenFormatted,
                                @Error)";

                conn.Execute(sql, new
                {
                    TestName = results.RunnerName,
                    Title = results.Title,
                    YAxisLegend = results.YAxisLegend,
                    RanAt = results.RanAt,
                    TimeTaken = results.TicksTaken,
                    TimeTakenFormatted = results.TimeTakenFormatted,
                    Error = results.Error
                });
            }
        }
Esempio n. 2
0
        private List<RunResults> RunAllRunners()
        {
            var results = new List<RunResults>();

            Parallel.ForEach(_runners, x =>
            {
                "Running {0}".LogInformation(x.RunnerName);

                var error = true;
                var result = new RunResults(x.RunnerName, x.Title, x.YAxisLegend);

                try
                {
                    error = x.Run();
                }
                catch
                {
                    result.Error = 1;
                }

                result.TicksTaken = x.TimeTaken.Ticks;
                result.Error = error ? 1 : 0;
                results.Add(result);

                "Finished running {0}. Time taken: {1}ms. Errored: {2}".LogInformation(x.RunnerName, x.TimeTaken.TotalMilliseconds, error.ToString().ToLower());
            });

            return results;
        }