Пример #1
0
    private void ToolTestScoreToJson(ToolTestBase toolTest, JObject output)
    {
      base.ToolTestToJson(toolTest, output);
      var tool = (JObject) output["Tools"].Last;
      string toolName = toolTest.ShortToolName;

      tool.Add("Performed", new JValue(Get(toolName, "Performed")));
      tool.Add("Passed", new JValue(Get(toolName, "Passed")));
      tool.Add("Failed", new JValue(Get(toolName, "Failed")));
      tool.Add("Score", new JValue(Get(toolName, "Score")));
    }
Пример #2
0
 protected override void ToolTestToJson(ToolTestBase toolTest, JObject output)
 {
   if (!(toolTest is Tests.Linq.MaximumTest))
     ToolTestScoreToJson(toolTest, output);
   else {
     foreach (JObject test in (JArray) output["Tests"]) {
       object maximum = Get(toolTest.ShortToolName, ((string) test["Name"]));
       maximum = JObject.Parse(JsonConvert.SerializeObject(maximum));
       test.Add("Maximum", (JObject) maximum);
     }
   }
 }
Пример #3
0
        protected virtual void ToolTestToJson(ToolTestBase toolTest, JObject output)
        {
            var tool = new JObject();

            tool.Add("ShortName", toolTest.ShortToolName);
            tool.Add("Name", toolTest.ToolName);
            ((JArray)output["Tools"]).Add(tool);
            tool.Add("Results", new JArray());

            foreach (var test in output["Tests"])
            {
                ToolTestResultToJson(Get(toolTest.ShortToolName, ((string)test["Name"])), tool);
            }
        }
Пример #4
0
        protected virtual void ToolTestToJson(ToolTestBase toolTest, JObject output)
        {
            var tool = new JObject();
            tool.Add("ShortName", toolTest.ShortToolName);
            tool.Add("Name", toolTest.ToolName);
            ((JArray) output["Tools"]).Add(tool);
            tool.Add("Results", new JArray());

            foreach (var test in output["Tests"])
                ToolTestResultToJson(Get(toolTest.ShortToolName, ((string) test["Name"])), tool);
        }
Пример #5
0
        public string ToJson(string cardName, ToolTestBase[] toolTests)
        {
            var result = new JObject();
            result.Add("Name", cardName);
            result.Add("Tests", new JArray());

            foreach (var test in Tests)
                TestToJson(test.ToString(), result);

            result.Add("Tools", new JArray());

            foreach (var toolTest in toolTests)
                ToolTestToJson(toolTest, result);

            return result.ToString();
        }