/// <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(); helper.SaveSingleFields(element, this, parameters); helper.SaveSimpleField(element, "Exception", this.exception, null); }
/// <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> public void Save(XmlElement element, XmlTestStoreParameters parameters) { EqtAssert.ParameterNotNull(element, "element"); XmlPersistence helper = new XmlPersistence(); helper.SaveSimpleField(element, "@agentName", this.agentName, null); helper.SaveSimpleField(element, "@agentDisplayName", this.agentDisplayName, this.agentName); helper.SaveSimpleField(element, "@isFromRemoteAgent", this.isFromRemoteAgent, false); helper.SaveSimpleField(element, "@uri", this.uri.AbsoluteUri, null); helper.SaveSimpleField(element, "@collectorDisplayName", this.collectorDisplayName, string.Empty); IList <UriDataAttachment> uriAttachments = new List <UriDataAttachment>(); foreach (IDataAttachment attachment in this.Attachments) { UriDataAttachment uriAtt = attachment as UriDataAttachment; if (uriAtt != null) { uriAttachments.Add(uriAtt); } } helper.SaveIEnumerable(uriAttachments, element, "UriAttachments", "A", "UriAttachment", 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); }
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 parameter /// </param> public void Save(XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); helper.SaveSimpleField(element, "@className", this.className, string.Empty); helper.SaveSimpleField(element, "@name", this.name, string.Empty); helper.SaveSimpleField(element, "isValid", this.isValid, false); }
/// <summary> /// Saves the class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameter /// </param> public void Save(XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); helper.SaveSingleFields(element, this, parameters); helper.SaveIEnumerable(this.runLevelErrorsAndWarnings, element, "RunInfos", ".", "RunInfo", parameters); helper.SaveIEnumerable(this.resultFiles, 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 override void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { base.Save(element, parameters); XmlPersistence h = new XmlPersistence(); h.SaveSimpleField(element, "TestMethod/@codeBase", this.codeBase, string.Empty); h.SaveSimpleField(element, "TestMethod/@adapterTypeName", this.adapter, string.Empty); h.SaveObject(this.testMethod, element, "TestMethod", parameters); }
public override void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { base.Save(element, parameters); XmlPersistence helper = new XmlPersistence(); if (this.InnerResults.Count > 0) { helper.SaveIEnumerable(this.InnerResults, element, "InnerResults", ".", null, parameters); } }
public override void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { base.Save(element, parameters); XmlPersistence h = new XmlPersistence(); if (testLinks.Count > 0) { h.SaveIEnumerable(testLinks.Values, element, "TestLinks", ".", "TestLink", 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 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> /// Gets the location of the test ID under an XML element, based on the specified parameters. /// This method is needed to parse the parameters sent by the caller of Save and Load. /// We need to support different locations for saving the test ID, because previously, TestEntry and TestResult stored the test ID to @testId /// (which is now the default location the TestId class' Save and Load methods), but TestElement was storing it to @id. /// Since we can't change the location where the ID is stored in XML, we support custom locations in the TestId class. /// </summary> /// <param name="parameters">The parameters specifying the locations</param> /// <param name="idLocation">The test ID location</param> private void GetIdLocation(XmlTestStoreParameters parameters, out string idLocation) { // Initialize to the default ID location idLocation = DefaultIdLocation; // If any parameters are specified, see if we need to override the defaults if (parameters != null) { object idLocationObj; if (parameters.TryGetValue(IdLocationKey, out idLocationObj)) { idLocation = idLocationObj as string ?? idLocation; } } }
/// <summary> /// Saves the class under the XmlElement. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameter /// </param> public void Save(XmlElement element, XmlTestStoreParameters parameters) { EqtAssert.ParameterNotNull(element, "element"); XmlPersistence helper = new XmlPersistence(); helper.SaveSimpleField(element, ".", this.description, null); // The URI is not a true URI, it must always be a local path represented as a URI. Also, the URI can be absolute or // relative. We use OriginalString because: // - ToString gets a string in the form "file://..." for an absolute URI and what was passed in for a relative URI // - AbsoluteUri only works for an absolute URI naturally // - LocalPath only works for an absolute URI // Due to the above assumption, that it is always an absolute or relative local path to a file, it's simplest and // safest to treat the URI as a string and just use OriginalString. helper.SaveSimpleField(element, "@href", this.uri.OriginalString, null); }
/// <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 class under the XmlElement.. /// </summary> /// <param name="element"> /// The parent xml. /// </param> /// <param name="parameters"> /// The parameter /// </param> public virtual void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { XmlPersistence helper = new XmlPersistence(); helper.SaveObject(this.id, element, ".", parameters); helper.SaveSimpleField(element, "@testName", this.resultName, string.Empty); helper.SaveSimpleField(element, "@computerName", this.computerInfo, string.Empty); helper.SaveSimpleField(element, "@ticketNumber", this.ticketNumber, 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); if (this.dataRowInfo >= 0) { helper.SaveSimpleField(element, "@dataRowInfo", this.dataRowInfo, -1); } if (!string.IsNullOrEmpty(this.resultType)) { helper.SaveSimpleField(element, "@resultType", this.resultType, 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(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); } }
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); } 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.SaveUsingReflection(element, this, null, 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.SaveUsingReflection(element, this, typeof(TestResultErrorInfo), parameters); }
/// <summary> /// Saves the class under the XmlElement. /// </summary> /// <param name="element"> XmlElement element </param> /// <param name="parameters"> XmlTestStoreParameters parameters</param> public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameters) { new XmlPersistence().SaveSingleFields(element, this, parameters); }