private async Task VerifyRelationTypesExistsOnTarget(IValidationContext context) { var sourceRelationTypes = await WorkItemTrackingHelpers.GetRelationTypesAsync(context.SourceClient.WorkItemTrackingHttpClient); var targetRelationTypes = await WorkItemTrackingHelpers.GetRelationTypesAsync(context.TargetClient.WorkItemTrackingHttpClient); foreach (var relationType in sourceRelationTypes) { //retrieve relations which are of type workitemlink defined by attribute kvp {"usage", "workitemlink"} //exclude remote link types because they need to be converted into hyperlinks if (IsWorkItemLinkType(relationType)) { if (RelationHelpers.IsRemoteLinkType(relationType)) { context.RemoteLinkRelationTypes.Add(relationType.ReferenceName); } else { if (TargetHasRelationType(relationType, targetRelationTypes)) { context.ValidatedWorkItemLinkRelationTypes.Add(relationType.ReferenceName); } else { Logger.LogWarning(LogDestination.File, $"Target: Relation type {relationType.ReferenceName} does not exist"); } } } } }
private async Task VerifyRelationTypesExistsOnTarget(IValidationContext context) { var sourceRelationTypes = await WorkItemTrackingHelpers.GetRelationTypesAsync(context.SourceClient.WorkItemTrackingHttpClient); var targetRelationTypes = await WorkItemTrackingHelpers.GetRelationTypesAsync(context.TargetClient.WorkItemTrackingHttpClient); var targetRelationNames = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (var relationType in sourceRelationTypes) { //retrieve relations which are of type workitemlink defined by attribute kvp {"usage", "workitemlink"} if (relationType.Attributes.ContainsKeyIgnoringCase(Constants.WorkItemLinkAttributeKey) && String.Equals(relationType.Attributes[Constants.WorkItemLinkAttributeKey].ToString(), Constants.WorkItemLinkAttributeValue, StringComparison.OrdinalIgnoreCase)) { if (TargetHasRelationType(relationType, targetRelationTypes)) { context.ValidatedWorkItemLinkRelationTypes.Add(relationType.ReferenceName); } else { Logger.LogWarning(LogDestination.File, $"Target: Relation type {relationType.ReferenceName} does not exist"); } } } }