public string PrintToXML(int tabCount) { string printout = ""; printout += new string('\t', tabCount); printout += "<TestResult>\r\n"; printout += MyReportWriter.PrintXmlElement("TestIdx", idx.ToString(), tabCount + 1); printout += MyReportWriter.PrintXmlElement("TestType", type.ToString(), tabCount + 1); printout += MyReportWriter.PrintXmlElement("TestDescription", description, tabCount + 1); foreach (TestCondition condition in conditions) { printout += condition.PrintToXML(tabCount + 1); } printout += MyReportWriter.PrintXmlElement("ResultStatus", status.ToString(), tabCount + 1); if (comments != "") { printout += MyReportWriter.PrintXmlElement("Comments", comments, tabCount + 1); } printout += new string('\t', tabCount); printout += "</TestResult>\r\n"; return(printout); }
public string PrintToJSON(int tabCount, bool useComma) { string printout = ""; string comma = ""; if (useComma) { comma = ","; } printout += new string('\t', tabCount) + "{\r\n"; printout += MyReportWriter.PrintJsonElement("ConditionId", id, tabCount + 1, true); printout += MyReportWriter.PrintJsonElement("ConditionOperation", operation.ToString(), tabCount + 1, true); printout += MyReportWriter.PrintJsonNumElement("ConditionParam1", param1, tabCount + 1, true); if (useTwoParams) { printout += MyReportWriter.PrintJsonNumElement("ConditionParam2", param2, tabCount + 1, true); } printout += MyReportWriter.PrintJsonNumElement("ConditionValue", outcome, tabCount + 1, true); printout += MyReportWriter.PrintJsonElement("ConditionStatus", status.ToString(), tabCount + 1, false); printout += new string('\t', tabCount) + "}" + comma + "\r\n"; return(printout); }
public string PrintToJSON(int tabCount, bool useComma) { string printout = ""; string comma = ""; if (useComma) { comma = ","; } printout += new string('\t', tabCount) + "{\r\n"; printout += MyReportWriter.PrintJsonNumElement("TestIdx", idx, tabCount + 1, true); printout += MyReportWriter.PrintJsonElement("TestType", type.ToString(), tabCount + 1, true); printout += MyReportWriter.PrintJsonElement("TestDescription", description, tabCount + 1, true); printout += new string('\t', tabCount + 1) + "\"Conditions\": [\r\n"; for (int i = 0; i < conditions.Count; i++) { if (i < (conditions.Count - 1)) { printout += conditions[i].PrintToJSON(tabCount + 2, true); } else { printout += conditions[i].PrintToJSON(tabCount + 2, false); } } printout += new string('\t', tabCount + 1) + "],\r\n"; if (comments != "") { printout += MyReportWriter.PrintJsonElement("ResultStatus", status.ToString(), tabCount + 1, true); printout += MyReportWriter.PrintJsonElement("Comments", comments, tabCount + 1, false); } else { printout += MyReportWriter.PrintJsonElement("ResultStatus", status.ToString(), tabCount + 1, false); } printout += new string('\t', tabCount) + "}" + comma + "\r\n"; return(printout); }
public string PrintToXML(int tabCount) { string printout = ""; printout += new string('\t', tabCount); printout += "<TestCondition>\r\n"; printout += MyReportWriter.PrintXmlElement("ConditionId", id, tabCount + 1); printout += MyReportWriter.PrintXmlElement("ConditionOperation", operation.ToString(), tabCount + 1); printout += MyReportWriter.PrintXmlElement("ConditionParam1", param1.ToString(), tabCount + 1); if (useTwoParams) { printout += MyReportWriter.PrintXmlElement("ConditionParam2", param2.ToString(), tabCount + 1); } printout += MyReportWriter.PrintXmlElement("ConditionValue", outcome.ToString(), tabCount + 1); printout += MyReportWriter.PrintXmlElement("ConditionStatus", status.ToString(), tabCount + 1); printout += new string('\t', tabCount); printout += "</TestCondition>\r\n"; return(printout); }