public virtual void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence h = new XmlPersistence(); h.SaveSimpleField(element, "@name", this.name, null); h.SaveSimpleField(element, "@storage", this.storage, string.Empty); h.SaveSimpleField(element, "@priority", this.priority, DefaultPriority); h.SaveSimpleField(element, "Owners/Owner/@name", this.owner, string.Empty); h.SaveObject(this.testCategories, element, "TestCategory", parameters); if (this.executionId != null) { h.SaveGuid(element, "Execution/@id", this.executionId.Id); } if (this.parentExecutionId != null) { h.SaveGuid(element, "Execution/@parentId", this.parentExecutionId.Id); } h.SaveObject(this.workItems, element, "Workitems", parameters); XmlTestStoreParameters testIdParameters = XmlTestStoreParameters.GetParameters(); testIdParameters[TestId.IdLocationKey] = "@id"; h.SaveObject(this.id, element, testIdParameters); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameter /// </param> public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); helper.SaveObject(this.id, element, ".", parameters); helper.SaveSimpleField(element, "@testName", this.testName, string.Empty); helper.SaveSimpleField(element, "@computerName", this.computerInfo, string.Empty); helper.SaveSimpleField(element, "@duration", this.duration, default(TimeSpan)); helper.SaveSimpleField(element, "@startTime", this.startTime, default(DateTime)); helper.SaveSimpleField(element, "@endTime", this.endTime, default(DateTime)); helper.SaveGuid(element, "@testType", this.testType.Id); if (this.stdOut != null) { this.stdOut = this.stdOut.Trim(); } if (this.stdErr != null) { this.stdErr = this.stdErr.Trim(); } helper.SaveSimpleField(element, "@outcome", this.outcome, default(TestOutcome)); helper.SaveSimpleField(element, "Output/StdOut", this.stdOut, string.Empty); helper.SaveSimpleField(element, "Output/StdErr", this.stdErr, string.Empty); helper.SaveSimpleField(element, "Output/DebugTrace", this.debugTrace, string.Empty); helper.SaveObject(this.errorInfo, element, "Output/ErrorInfo", parameters); helper.SaveGuid(element, "@testListId", this.categoryId.Id); helper.SaveIEnumerable(this.textMessages, element, "Output/TextMessages", ".", "Message", parameters); helper.SaveSimpleField(element, "@relativeResultsDirectory", this.relativeTestResultsDirectory, null); helper.SaveIEnumerable(this.resultFiles.Keys, element, "ResultFiles", "@path", "ResultFile", parameters); helper.SaveIEnumerable(this.collectorDataEntries, element, "CollectorDataEntries", ".", "Collector", parameters); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameter /// </param> public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence h = new XmlPersistence(); h.SaveSingleFields(element, this, parameters); h.SaveGuid(element, "@id", this.Id.Id); h.SaveGuid(element, "@parentListId", this.ParentCategoryId.Id); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameters. /// </param> public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); helper.SaveSingleFields(element, this, parameters); helper.SaveObject(this.testId, element, null); helper.SaveGuid(element, "@executionId", this.execId.Id); helper.SaveGuid(element, "@testListId", this.categoryId.Id); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameter /// </param> public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); if (this.executionId != null) { helper.SaveGuid(element, "@executionId", this.executionId); } if (this.parentExecutionId != null) { helper.SaveGuid(element, "@parentExecutionId", this.parentExecutionId); } helper.SaveGuid(element, "@testId", this.testId); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameter /// </param> public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence h = new XmlPersistence(); h.SaveSimpleField(element, "@name", this.name, null); h.SaveSimpleField(element, "@storage", this.storage, string.Empty); h.SaveSimpleField(element, "@priority", this.priority, DefaultPriority); h.SaveSimpleField(element, "Owners/Owner/@name", this.owner, string.Empty); h.SaveObject(this.testCategories, element, "TestCategory", parameters); // Save the test ID. We exclude "test" from the default locations used by TestId, since this is already a test // element. Ideally, we would let TestId save the IDs to the default locations, but the previous behavior of // TestElement was to store the test ID at @testId, and since we can't change this, TestId supports custom // locations for the IDs. See TestId.GetLocations for more info. XmlTestStoreParameters testIdParameters = XmlTestStoreParameters.GetParameters(); testIdParameters[TestId.IdLocationKey] = "@id"; h.SaveObject(this.id, element, testIdParameters); if (this.executionId != null) { h.SaveGuid(element, "Execution/@id", this.executionId.Id); } h.SaveSimpleField(element, "TestMethod/@codeBase", this.codeBase, string.Empty); h.SaveSimpleField(element, "TestMethod/@executorUriOfAdapter", this.executorUriOfAdapter, string.Empty); h.SaveObject(this.testMethod, element, "TestMethod", parameters); }
public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence h = new XmlPersistence(); h.SaveGuid(element, "@id", this.Id); h.SaveSimpleField(element, "@name", this.name, null); h.SaveSimpleField(element, "@storage", this.storage, string.Empty); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameters. /// </param> public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); helper.SaveSingleFields(element, this, parameters); helper.SaveObject(this.testId, element, null); helper.SaveGuid(element, "@executionId", this.executionId); if (parentExecutionId != null) { helper.SaveGuid(element, "@parentExecutionId", this.parentExecutionId); } helper.SaveGuid(element, "@testListId", this.categoryId.Id); if (this.TestEntries.Count > 0) { helper.SaveIEnumerable(TestEntries, element, "TestEntries", ".", "TestEntry", parameters); } }
/// <summary> /// Saves the state to the XML element /// </summary> /// <param name="element">The XML element to save to</param> /// <param name="parameters">Parameters to customize the save behavior</param> void IXmlTestStore.Save(XmlElement element, XmlTestStoreParameters parameters) { Debug.Assert(element != null, "element is null"); string idLocation; this.GetIdLocation(parameters, out idLocation); XmlPersistence helper = new XmlPersistence(); helper.SaveGuid(element, idLocation, this.id); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameters. /// </param> public void Save(XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); // Save all fields marked as StoreXmlSimpleField. helper.SaveSingleFields(element, this, parameters); helper.SaveGuid(element, "@id", this.id.Id); // When saving and loading a TRX file, we want to use the run deployment root directory based on where the TRX file // is being saved to or loaded from object filePersistenceRootObjectType; if (parameters.TryGetValue(XmlFilePersistence.RootObjectType, out filePersistenceRootObjectType) && (Type)filePersistenceRootObjectType == typeof(TestRun)) { Debug.Assert( parameters.ContainsKey(XmlFilePersistence.DirectoryPath), "TestRun is the type of the root object being saved to a file, but the DirectoryPath was not specified in the XML test store parameters"); Debug.Assert( !string.IsNullOrEmpty(this.runDeploymentRoot), "TestRun is the type of the root object being saved to a file, but the run deployment root directory is null or empty"); // We are saving a TestRun object as the root element in a file (TRX file), so just save the test run directory // name (last directory in the run deployment root), which is the relative path to the run deployment root // directory from the directory where the TRX file exists helper.SaveSimpleField( element, "Deployment/@runDeploymentRoot", FileHelper.MakePathRelative(this.runDeploymentRoot, Path.GetDirectoryName(this.runDeploymentRoot)), string.Empty); } else { // We are not saving a TestRun object as the root element in a file (i.e., we're not saving a TRX file), so just // save the run deployment root directory as is helper.SaveSimpleField(element, "Deployment/@runDeploymentRoot", this.runDeploymentRoot, string.Empty); } }