예제 #1
0
        public static List <QualityCenterDefectEntry> ParseSearchResult(string xml)
        {
            var results = new List <QualityCenterDefectEntry>();
            var doc     = XDocument.Parse(xml);

            foreach (var entity in doc.Root.Descendants("Entity"))
            {
                var fields = entity.Descendants("Fields").First().Descendants("Field");

                var defect = new QualityCenterDefectEntry
                {
                    Id             = int.Parse(GetFieldStringValue(fields, "id")),
                    Summary        = WordUtil.SanitizeSubject(GetFieldStringValue(fields, "name")),
                    Description    = HtmlUtil.ConvertHtml(GetFieldStringValue(fields, "description")),
                    Severity       = TranslateSeverity(GetFieldStringValue(fields, "severity")),
                    DetectedBy     = GetFieldStringValue(fields, "detected-by"),
                    Status         = GetFieldStringValue(fields, "status"),
                    DetectedOnDate = GetFieldDateValue(fields, QualityCenterField.DetectedonDate),
                    AssignedTo     = GetFieldStringValue(fields, QualityCenterField.AssignTo),
                    Tags           = GetFieldStringValue(fields, QualityCenterField.Tags)
                };

                results.Add(defect);
            }

            return(results);
        }
예제 #2
0
        private static QualityCenterDefectEntry BuildDefectFromNode(XElement node)
        {
            var fields = node.Descendants("Fields").First().Descendants("Field");

            var defect = new QualityCenterDefectEntry
            {
                Id                = int.Parse(GetFieldStringValue(fields, "id")),
                Product           = GetFieldStringValue(fields, QualityCenterField.Product),
                SubSystem         = GetFieldStringValue(fields, QualityCenterField.Subsystem),
                Component         = GetFieldStringValue(fields, QualityCenterField.Component),
                FoundInRelease    = GetFieldStringValue(fields, QualityCenterField.FoundinRelease),
                Priority          = GetFieldStringValue(fields, QualityCenterField.Priority),
                State             = GetFieldStringValue(fields, QualityCenterField.State),
                TargetVersion     = GetFieldStringValue(fields, QualityCenterField.TargetVersion),
                TargetRelease     = GetFieldStringValue(fields, QualityCenterField.TargetRelease),
                Summary           = WordUtil.SanitizeSubject(GetFieldStringValue(fields, "name")),
                Description       = HtmlUtil.ConvertHtml(GetFieldStringValue(fields, "description")),
                Severity          = TranslateSeverity(GetFieldStringValue(fields, "severity")),
                ReadyForTestDate  = GetFieldDateValue(fields, QualityCenterField.ReadyforTestDate),
                CodeCompleteDate  = GetFieldDateValue(fields, QualityCenterField.CodeCompleteDate),
                ReadyForBuildDate = GetFieldDateValue(fields, QualityCenterField.ReadyForBuildDate),
                ClosedDate        = GetFieldDateValue(fields, QualityCenterField.ClosedDate),
                DevReqCloseDate   = GetFieldDateValue(fields, QualityCenterField.DevReqCloseDate),
                LastChangedBy     = GetFieldStringValue(fields, QualityCenterField.LastChangeBy),
                LastChangeDate    = GetFieldDateValue(fields, QualityCenterField.LastChangeDate),
                DetectedBy        = GetFieldStringValue(fields, "detected-by"),
                Status            = GetFieldStringValue(fields, "status"),
                DetectedOnDate    = GetFieldDateValue(fields, QualityCenterField.DetectedonDate),
                AssignedTo        = GetFieldStringValue(fields, QualityCenterField.AssignTo),
                Tags              = GetFieldStringValue(fields, QualityCenterField.Tags)
            };

            return(defect);
        }