private static async Task IterateWorkItems(List <EFU> efus, List <WorkitemRelation> relations, EFU parent, WiqlRelationList wis) { if (relations.Count > 0) { var workitems = await GetWorkItems(relations.ToList()); foreach (var wi in workitems) { ColorConsole.WriteLine($" {wi.fields.SystemWorkItemType} ".PadRight(13) + wi.id.ToString().PadLeft(4) + Dot + wi.fields.SystemTitle + $" [{wi.fields.SystemTags}]"); var efu = new EFU { Id = wi.id, Title = wi.fields.SystemTitle, Description = wi.fields.SystemDescription, Workitemtype = wi.fields.SystemWorkItemType, AcceptanceCriteria = wi.fields.MicrosoftVSTSCommonAcceptanceCriteria, Tags = wi.fields.SystemTags, Url = wi?.url, Parent = parent?.Id, }; efus.Add(efu); parent?.Children.Add(efu.Id); await IterateWorkItems(efus, wis.workItemRelations.Where(x => x.source != null && x.source.id.Equals(wi.id)).ToList(), efu, wis); } } }
private static string GetContent(EFU efu) { if (efu == null) { return(string.Empty); } var desc = string.IsNullOrWhiteSpace(efu.Description) ? string.Empty : efu.Description.TrimEx(); if (efu.Workitemtype.Equals("Epic", StringComparison.OrdinalIgnoreCase)) { return($"<hr style=\"border:0;height:1px\"/><br/><div style=\"color:#242424\"><b>E-" + efu.Id + ". <u>" + (efu.Title?.ToUpperInvariant() ?? string.Empty) + "</u></b></div>" + desc); } if (efu.Workitemtype.Equals("Feature", StringComparison.OrdinalIgnoreCase)) { return($"<div style=\"color:#727272\"><b>F-" + efu.Id + ". " + (efu.Title?.ToUpperInvariant() ?? string.Empty) + "</b></div>" + desc); } var acceptance = string.IsNullOrWhiteSpace(efu.AcceptanceCriteria?.TrimEx()) ? string.Empty : "<b>Acceptance Criteria</b>: " + efu.AcceptanceCriteria.TrimEx(); return($"<div style=\"color:{Extensions.HeadersColor}\">U-" + efu.Id + ". " + (efu.Title ?? string.Empty) + "</div>" + desc + acceptance); }