コード例 #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");
        }
コード例 #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);
        }
コード例 #3
0
ファイル: ResultsStatsWriter.cs プロジェクト: uShip/Concord
 public void OutputRunStats(TimeSpan totalRuntime, RunStatsCollection runStatsCollection)
 {
     //Do nothing, this format of output is going to be obsolete soon?
 }
コード例 #4
0
ファイル: ResultsOrderService.cs プロジェクト: uShip/Concord
        /// <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 + "{"));
        }