/// <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> /// Create a new TestCategoryItemCollection based on the string array. /// </summary> /// <param name="items">Add these items to the collection.</param> public TestCategoryItemCollection(string[] items) { EqtAssert.ParameterNotNull(items, "items"); foreach (string s in items) { this.Add(s); } }
private void Initialize(string desc, Uri uri) { EqtAssert.ParameterNotNull(desc, "desc"); EqtAssert.ParameterNotNull(uri, "uri"); this.description = desc; this.uri = uri; }
/// <summary> /// Create a new WorkItemCollection based on the int array. /// </summary> /// <param name="items">Add these items to the collection.</param> public WorkItemCollection(int[] items) { EqtAssert.ParameterNotNull(items, nameof(items)); foreach (int i in items) { this.Add(new WorkItem(i)); } }
/// <summary> /// Constructor for TestListCategory . /// </summary> /// <param name="name">The name of new category.</param> /// <param name="parentCategoryId">Id of parent category. Use TestListCategoryId.Root for top level categories.</param> public TestListCategory(string name, TestListCategoryId parentCategoryId) { EqtAssert.StringNotNullOrEmpty(name, "name"); EqtAssert.ParameterNotNull(parentCategoryId, "parentCategoryId"); this.name = name; this.parentCategoryId = parentCategoryId; }
/// <summary> /// Initializes a new instance of the <see cref="TestRunConfiguration"/> class. /// </summary> /// <param name="name"> /// The name of Run Configuration. /// </param> public TestRunConfiguration(string name) { EqtAssert.ParameterNotNull(name, "name"); this.name = name; this.runDeploymentRoot = string.Empty; this.id = new TestRunConfigurationId(); }
/// <summary> /// Initializes a new instance of the <see cref="TestRunConfiguration"/> class. /// </summary> /// <param name="name"> /// The name of Run Configuration. /// </param> /// <param name="trxFileHelper"> /// InternalFileHelper instance to use in file operations. /// </param> internal TestRunConfiguration(string name, TrxFileHelper trxFileHelper) { EqtAssert.ParameterNotNull(name, "name"); this.name = name; this.runDeploymentRoot = string.Empty; this.id = new TestRunConfigurationId(); this.trxFileHelper = trxFileHelper; }
/// <summary> /// Adds the category. /// </summary> /// <param name="item">Category to be added.</param> public override void Add(TestCategoryItem item) { EqtAssert.ParameterNotNull(item, "item"); // Don't add empty items. if (!String.IsNullOrEmpty(item.TestCategory)) { base.Add(item); } }
public TestLink(Guid id, string name, string storage) { if (id == Guid.Empty) { throw new ArgumentException("ID cant be empty"); } EqtAssert.StringNotNullOrEmpty(name, "name"); EqtAssert.ParameterNotNull(storage, "storage"); this.id = id; this.name = name; this.storage = storage; }
/// <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); }
private void Initialize(Uri uri, string collectorDisplayName, string agentName, string agentDisplayName, bool isFromRemoteAgent, IEnumerable <IDataAttachment> attachments) { EqtAssert.ParameterNotNull(uri, "uri"); EqtAssert.StringNotNullOrEmpty(collectorDisplayName, "collectorDisplayName"); EqtAssert.StringNotNullOrEmpty(agentName, "agentName"); EqtAssert.StringNotNullOrEmpty(agentDisplayName, "agentDisplayName"); if (null != attachments) { // Copy the attachments foreach (IDataAttachment attachment in attachments) { this.AddAttachment(attachment); } } // Note that the data can be null. this.uri = uri; this.collectorDisplayName = collectorDisplayName; this.agentName = agentName.Trim(); this.agentDisplayName = agentDisplayName.Trim(); this.isFromRemoteAgent = isFromRemoteAgent; }
/// <summary> /// WARNING: do not use from inside Test Adapters, use from only on HA by UI etc. /// Returns directory on HA for dependent files for TestResult. XmlPersistence method for UI. /// Throws on error (e.g. if deployment directory was not set for test run). /// </summary> /// <param name="result"> /// Test Result to get dependent files directory for. /// </param> /// <returns> /// Result directory. /// </returns> internal string GetResultFilesDirectory(UnitTestResult result) { EqtAssert.ParameterNotNull(result, "result"); return(Path.Combine(this.GetResultsDirectory(), result.RelativeTestResultsDirectory)); }
/// <summary> /// Helper function to add a text message info to the test result /// </summary> /// <param name="text">Message to be added</param> public void AddTextMessage(string text) { EqtAssert.ParameterNotNull(text, "text"); this.textMessages.Add(text); }
/// <summary> /// Adds the workitem. /// </summary> /// <param name="item">WorkItem to be added.</param> public override void Add(WorkItem item) { EqtAssert.ParameterNotNull(item, nameof(item)); base.Add(item); }
/// <summary> /// Used internally for fake uncategorized category. /// </summary> /// <param name="name"> /// Category name. /// </param> /// <param name="id"> /// Category id. /// </param> /// <param name="parentId"> /// The parent Id. /// </param> private TestListCategory(string name, TestListCategoryId id, TestListCategoryId parentId) : this(name, parentId) { EqtAssert.ParameterNotNull(id, "id"); this.id = id; }