/// <summary> /// Initializes a new instance of the <see cref="TtDefect"/> class. /// </summary> /// <param name="DefaultConfigFile"> /// The default config file. /// </param> public TtDefect(string DefaultConfigFile) { this.defect = ReadTTItemSoapConfig(DefaultConfigFile); this.SetDates(); }
/// <summary> /// Cretes the default defect. /// </summary> /// <param name="username">The username.</param> /// <param name="foundinversion">The foundinversion.</param> /// <param name="summary">The summary.</param> /// <param name="comments">The comments.</param> /// <param name="getHomeFile">if set to <c>true</c> [get home file].</param> private void CreteDefaultDefect(string username, string foundinversion, string summary, string comments, bool getHomeFile) { this.defect = new CDefect(); this.SetCustomValues(username, summary); this.AddReportedByRecord(username, foundinversion, comments); this.SetDates(); this.defect.eventlist = new CEvent[0]; this.defect.pSCCFileList = new CSCCFileRecord[0]; var customfields = new List<CField>(); var homeEnvironment = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); if (File.Exists(this.externalConfigFile)) { CreateRecordFromConfigurationFile( File.ReadAllLines(this.externalConfigFile), this.defect, customfields); } else { if (File.Exists(Path.Combine(homeEnvironment, "TesttrackSetup.cfg")) && getHomeFile) { CreateRecordFromConfigurationFile( File.ReadAllLines(Path.Combine(homeEnvironment, "TesttrackSetup.cfg")), this.defect, customfields); } } this.defect.customFieldList = customfields.ToArray(); this.timeD = CreateDefaultCDefect(username, foundinversion, summary, comments); }
/// <summary> /// Initializes a new instance of the <see cref="TtDefect"/> class. /// </summary> /// <param name="connection"> /// The connection. /// </param> /// <param name="TTNumber"> /// The tt number. /// </param> public TtDefect(IIssueManagementConnection connection, long TTNumber) { connection.EnableFormattedTextSupport(); this.defect = connection.getDefect(TTNumber); }
/// <summary> /// The read tt item soap config. /// </summary> /// <param name="ConfigFile"> /// The config file. /// </param> /// <returns> /// The <see cref="CDefect"/>. /// </returns> public static CDefect ReadTTItemSoapConfig(string ConfigFile) { SerializableCDefect defect = null; using (Stream stream = File.Open(ConfigFile, FileMode.Open, FileAccess.Read)) { IFormatter formatter = new SoapFormatter(); defect = (SerializableCDefect)formatter.Deserialize(stream); } return defect != null ? defect.ToCDefect() : null; }
private CDefect CreateDefaultCDefect(string username, string foundinversion, string summary, string comments) { var defectInd = new CDefect(); defectInd.enteredby = username; defectInd.summary = summary; defectInd.createdbyuser = username; defectInd.modifiedbyuser = username; defectInd.type = "Incorrect functionality"; defectInd.product = "Product Development (for PD use only)"; defectInd.severity = "Automated Testing"; defectInd.state = "Open"; defectInd.disposition = "Bat"; defectInd.reportedbylist = new CReportedByRecord[1]; defectInd.reportedbylist[0] = new CReportedByRecord(); defectInd.reportedbylist[0].foundby = username; defectInd.reportedbylist[0].foundinversion = foundinversion; defectInd.reportedbylist[0].comments = comments; defectInd.dateentered = DateTime.Now; defectInd.dateenteredSpecified = true; defectInd.datetimecreated = DateTime.Now; defectInd.datetimecreatedSpecified = true; defectInd.datetimemodified = DateTime.Now; defectInd.datetimemodifiedSpecified = true; defectInd.reportedbylist[0].datefound = DateTime.Now; defectInd.reportedbylist[0].datefoundSpecified = true; defectInd.eventlist = new CEvent[0]; defectInd.pSCCFileList = new CSCCFileRecord[0]; var customfields = new List<CField>(); // ===== Maintenance AddCustomStringField(customfields, "Maintenance", string.Empty); // ===== Defective since v. AddCustomDropdownFieldField(customfields, "Defective since v.", "Work"); // ===== ProjectPlan AddCustomDropdownFieldField(customfields, "ProjectPlan", string.Empty); // ===== Work order AddCustomStringField(customfields, "Work order", string.Empty); // ===== Release blocker AddCustomDropdownFieldField(customfields, "Release blocker", string.Empty); // ===== Defect reason AddCustomDropdownFieldField(customfields, "Defect reason", string.Empty); // ===== SubTeam AddCustomDropdownFieldField(customfields, "SubTeam", string.Empty); // ===== Reproduced AddCustomDropdownFieldField(customfields, "Reproduced", "Always"); // ===== Maintenance - Area priorities AddCustomStringField(customfields, "Maintenance - Area priorities", string.Empty); // ===== Component AddCustomDropdownFieldField(customfields, "Component", "Drawings"); // ===== SubComponent AddCustomDropdownFieldField(customfields, "SubComponent", "Other"); // ===== Effect on usage AddCustomDropdownFieldField(customfields, "Effect on usage", "No workaround, work discontinued"); // ===== Severity AddCustomDropdownFieldField(customfields, "Severity", string.Empty); defectInd.customFieldList = customfields.ToArray(); return defectInd; }
private void AppendEvent(CDefect def, CEvent de) { // Add the event to defect's eventlist. if (def.eventlist == null || def.eventlist.Length == 0) { // No events, so we can just create a new list. def.eventlist = new CEvent[1]; def.eventlist[0] = de; } else { // Append new event to end of existing list. ArrayList list = new ArrayList(); for (int i = 0; i < def.eventlist.Length; ++i) list.Add(def.eventlist[i]); // add new event to list list.Add(de); def.eventlist = new CEvent[def.eventlist.Length + 1]; for (int i = 0; i < list.Count; ++i) def.eventlist[i] = (CEvent)list[i]; } }
public static void CreateRecordFromConfigurationFile(string[] lines, CDefect defect, List<CField> customfields) { foreach (var line in lines) { if (line.Trim().StartsWith("//")) { continue; } var elems = line.Split(';'); if (line.Trim().StartsWith("CustomStringField")) { try { AddCustomStringField(customfields, elems[1].Trim(), elems[2].Trim()); } catch (Exception) { AddCustomStringField(customfields, elems[1].Trim(), string.Empty); } continue; } if (line.Trim().StartsWith("CustomIntField")) { try { AddCustomIntField(customfields, elems[1].Trim(), int.Parse(elems[2].Trim())); } catch (Exception) { AddCustomIntField(customfields, elems[1].Trim(), 0); } continue; } if (line.Trim().StartsWith("CustomDropdownField")) { try { AddCustomDropdownFieldField(customfields, elems[1].Trim(), elems[2].Trim()); } catch (Exception) { AddCustomDropdownFieldField(customfields, elems[1].Trim(), string.Empty); } continue; } if (line.Trim().StartsWith("Type")) { defect.type = elems[1].Trim(); continue; } if (line.Trim().StartsWith("Product")) { defect.product = elems[1].Trim(); continue; } if (line.Trim().StartsWith("Severity")) { defect.severity = elems[1].Trim(); continue; } if (line.Trim().StartsWith("State")) { defect.state = elems[1].Trim(); continue; } if (line.Trim().StartsWith("Disposition")) { try { defect.disposition = elems[1].Trim(); } catch (Exception) { defect.disposition = string.Empty; } continue; } } }
/// <remarks/> public void saveDefectAsync(long cookie, CDefect pDefect, object userState) { if ((this.saveDefectOperationCompleted == null)) { this.saveDefectOperationCompleted = new System.Threading.SendOrPostCallback(this.OnsaveDefectOperationCompleted); } this.InvokeAsync("saveDefect", new object[] { cookie, pDefect}, this.saveDefectOperationCompleted, userState); }
/// <summary> /// The create defect. /// </summary> /// <param name="Defect"> /// The defect. /// </param> /// <returns> /// The <see cref="long"/>. /// </returns> public long CreateDefect(CDefect Defect) { return this.ttSOAP.addDefect(this.ttCookie, Defect); }
public int saveDefect(long cookie, CDefect pDefect) { object[] results = this.Invoke("saveDefect", new object[] { cookie, pDefect}); return ((int)(results[0])); }
/// <remarks/> public void saveDefectAsync(long cookie, CDefect pDefect) { this.saveDefectAsync(cookie, pDefect, null); }
/// <remarks/> public void addDefectWithLinkAsync(long cookie, CDefect pDefect, long testRunRecordID, object userState) { if ((this.addDefectWithLinkOperationCompleted == null)) { this.addDefectWithLinkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnaddDefectWithLinkOperationCompleted); } this.InvokeAsync("addDefectWithLink", new object[] { cookie, pDefect, testRunRecordID}, this.addDefectWithLinkOperationCompleted, userState); }
/// <remarks/> public void addDefectWithLinkAsync(long cookie, CDefect pDefect, long testRunRecordID) { this.addDefectWithLinkAsync(cookie, pDefect, testRunRecordID, null); }
public long addDefectWithLink(long cookie, CDefect pDefect, long testRunRecordID) { object[] results = this.Invoke("addDefectWithLink", new object[] { cookie, pDefect, testRunRecordID}); return ((long)(results[0])); }
/// <remarks/> public void addDefectAsync(long cookie, CDefect pDefect) { this.addDefectAsync(cookie, pDefect, null); }
public long addDefect(long cookie, CDefect pDefect) { object[] results = this.Invoke("addDefect", new object[] { cookie, pDefect}); return ((long)(results[0])); }