private ItemType[] CreateFakeItemTypes() { var newItemType = new xmlfilecontent_item() { filepath = OvalHelper.CreateItemEntityWithStringValue("c:\\temp\\file1.txt"), xpath = OvalHelper.CreateItemEntityWithStringValue("xxx"), }; return(new ItemType[] { newItemType }); }
private string GetCompleteFilepath(xmlfilecontent_item xmlFileContentItem) { if (IsFilePathDefined(xmlFileContentItem)) { return(xmlFileContentItem.filepath.Value); } else { return(Path.Combine(xmlFileContentItem.path.Value, xmlFileContentItem.filename.Value)); } }
private void ConfigureXmlFileContentItem(xmlfilecontent_item xmlFileContentItem, IEnumerable <String> xPathResult) { var completeFilepath = this.GetCompleteFilepath(xmlFileContentItem); xmlFileContentItem.filepath = OvalHelper.CreateItemEntityWithStringValue(completeFilepath); xmlFileContentItem.path = OvalHelper.CreateItemEntityWithStringValue(Path.GetDirectoryName(completeFilepath)); xmlFileContentItem.filename = OvalHelper.CreateItemEntityWithStringValue(Path.GetFileName(completeFilepath)); xmlFileContentItem.value_of = new EntityItemAnySimpleType[xPathResult.Count()]; for (int i = 0; i < xPathResult.Count(); i++) { xmlFileContentItem.value_of[i] = OvalHelper.CreateEntityItemAnyTypeWithValue(xPathResult.ElementAt(i)); } }
private bool IsFilePathDefined(xmlfilecontent_item xmlFileContentItem) { var filepathEntity = xmlFileContentItem.filepath; return((filepathEntity != null) && (!string.IsNullOrEmpty(filepathEntity.Value))); }