Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ReflectedWorkItemID logic for TestPlandsAndSuitesMigration #905

Merged
merged 3 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ public TfsReflectedWorkItemId(WorkItemData workItem) : base(workItem)
_Connection = workItem.ToWorkItem().Store.TeamProjectCollection.Uri;
}

public TfsReflectedWorkItemId(int workItemId, string tfsProject, Uri tfsTeamProjectCollection) : base(workItemId)
{
if (workItemId == 0)
{
throw new ArgumentNullException(nameof(workItemId));
}

_WorkItemId = workItemId.ToString();
_ProjectName = tfsProject;
_Connection = tfsTeamProjectCollection;
}

public TfsReflectedWorkItemId(string ReflectedWorkItemId) : base(ReflectedWorkItemId)
{
if (ReflectedWorkItemId is null)
Expand Down
10 changes: 9 additions & 1 deletion src/MigrationTools/_EngineV1/Clients/ReflectedWorkItemId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace MigrationTools._EngineV1.Clients
{
public abstract class ReflectedWorkItemId
{

public ReflectedWorkItemId(WorkItemData workItem)
{
if (workItem is null)
Expand All @@ -25,6 +24,15 @@ public ReflectedWorkItemId(string ReflectedWorkItemId)
WorkItemId = ReflectedWorkItemId;
}

public ReflectedWorkItemId(int ReflectedWorkItemId)
{
if (ReflectedWorkItemId == 0)
{
throw new ArgumentNullException(nameof(ReflectedWorkItemId));
}
WorkItemId = ReflectedWorkItemId.ToString();
}

public override string ToString()
{
return WorkItemId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.TeamFoundation.Framework.Common;
using Microsoft.TeamFoundation.TestManagement.Client;
using MigrationTools;
using MigrationTools._EngineV1.Clients;
using MigrationTools._EngineV1.Configuration;
using MigrationTools._EngineV1.Configuration.Processing;
using MigrationTools._EngineV1.Processors;
Expand Down Expand Up @@ -613,7 +614,8 @@ private void FixWorkItemIdInQuery(ITestSuiteBase targetSuitChild)
foreach (Match match in matches)
{
var qid = match.Value.Split('=')[1].Trim();
var targetWi = Engine.Target.WorkItems.FindReflectedWorkItemByReflectedWorkItemId(qid);
TfsReflectedWorkItemId reflectedString = new TfsReflectedWorkItemId(int.Parse(qid), Engine.Source.Config.AsTeamProjectConfig().Project, Engine.Source.Config.AsTeamProjectConfig().Collection);
var targetWi = Engine.Target.WorkItems.FindReflectedWorkItemByReflectedWorkItemId(reflectedString.ToString());

if (targetWi == null)
{
Expand Down