Ejemplo n.º 1
0
        public IDictionary <string, object> AsDict()
        {
            var logURLs = new Dictionary <string, string> ();

            if (LogURL != null)
            {
                string defaultURL;
                logURLs.TryGetValue("*", out defaultURL);
                if (defaultURL == null)
                {
                    logURLs ["*"] = LogURL;
                }
                else if (defaultURL != LogURL)
                {
                    foreach (var run in Runs)
                    {
                        logURLs [run.Benchmark.Name] = LogURL;
                    }
                }
            }

            var dict = new Dictionary <string, object> ();

            dict ["MainProduct"]        = Commit.AsDict();
            dict ["SecondaryProducts"]  = SecondaryCommits.Select(c => c.AsDict()).ToList();
            dict ["Machine"]            = Machine.AsDict();
            dict ["Config"]             = Config.AsDict();
            dict ["TimedOutBenchmarks"] = new List <string> (TimedOutBenchmarks);
            dict ["CrashedBenchmarks"]  = new List <string> (CrashedBenchmarks);
            dict ["StartedAt"]          = StartDateTime.ToString(DATETIME_FORMAT);
            dict ["FinishedAt"]         = FinishDateTime.ToString(DATETIME_FORMAT);
            dict ["BuildURL"]           = BuildURL;
            dict ["LogURLs"]            = logURLs;
            dict ["Runs"] = Runs.Select(r => r.AsDict()).ToList();
            if (PullRequestBaselineRunSetId != null)
            {
                var prDict = new Dictionary <string, object> ();
                prDict ["BaselineRunSetID"] = PullRequestBaselineRunSetId.Value;
                prDict ["URL"]       = PullRequestURL;
                dict ["PullRequest"] = prDict;
            }
            return(dict);
        }