Exemplo n.º 1
0
        public RunStatsCollection MigrateCollection(RunStatsCollection collection)
        {
            if (collection.StatsVersion == TargetVersion)
            {
                return collection;
            }

            if (collection.StatsVersion == 0)
            {
                var stats = collection.Records.ToList();
                stats.ForEach(x =>
                {
                    x.WeightedAverageTime = x.AverageTime;
                    x.FailedAverageTime = x.AverageTime;
                });
                collection.Records = stats;
                collection.StatsVersion = 2;
                return collection;
            }
            if (collection.StatsVersion == 1)
            {
                throw new NotSupportedException("There really was no version 1...");
            }
            if (collection.StatsVersion == 2)
            {
                //Current version
                return collection;
            }

            throw new IndexOutOfRangeException("Unknown StatsVersion");
        }
Exemplo n.º 2
0
        public void OutputRunStats(TimeSpan totalRuntime, RunStatsCollection runStatsCollection)
        {
            //TODO handle null history
            if (runStatsCollection == null)
                throw new NotImplementedException("TODO Need to handle null history at sometime...");

            var model = new FancyResults
            {
                TotalRuntime = totalRuntime,
                Runners = runStatsCollection.Records
            };

            _templateWriter.OutputResults(model, _settings.ResultsStatsFilepath);
        }
Exemplo n.º 3
0
 public void OutputRunStats(TimeSpan totalRuntime, RunStatsCollection runStatsCollection)
 {
     //Do nothing, this format of output is going to be obsolete soon?
 }
Exemplo n.º 4
0
        /// <summary>
        /// This must be called with the results from CombineWithRunnersHistories
        /// </summary>
        /// <param name="runStatsCollection"></param>
        public void OutputRunOrder(RunStatsCollection runStatsCollection)
        {
            var path = _settings.ResultsOrderDataFilepath;
            if (string.IsNullOrEmpty(path)) return;

            //Write data to file
            File.WriteAllText(path, JsonConvert.SerializeObject(runStatsCollection)
                                               .Replace("},", "}," + Environment.NewLine)
                                               .Replace("[{", "[" + Environment.NewLine + "{"));
        }