コード例 #1
0
ファイル: ResultsParser.cs プロジェクト: RajaBellebon/helper
        //RB: This function below bulk fill the results and add comments
        public static void FillTheResultsBulkAndCloseTheRun(JObject tr, JArray getRun, Dictionary <string, Tuple <int, string> > dict)
        {
            var st = tr.First;

            string[] ids     = (st.ToString()).Split(':');
            var      runId   = ids[1].TrimStart(); // RunID
            var      request = new AddResultsRequest();

            foreach (var item in getRun.Children())
            {
                var obj     = JObject.Parse(item.ToString());
                var title   = (string)obj.SelectToken("title");
                var id      = (string)obj.SelectToken("id");
                int res     = (int)obj.SelectToken("status_id");
                var comment = (string)obj.SelectToken("comment");
                if (dict.ContainsKey(title))
                {
                    var tupleStatusComment = dict[title];
                    res     = tupleStatusComment.Item1;
                    comment = tupleStatusComment.Item2;
                    AddResultsRequest.AddResultsItem addItem = new AddResultsRequest.AddResultsItem();
                    addItem.test_id   = id;
                    addItem.status_id = res;
                    addItem.comment   = comment;
                    request.results.Add(addItem);
                }
            }
            TestExporter.AddTestResults("add_results/" + runId, request);
            TestExporter.Post("close_run/" + runId);
        }