private ITestPlan CreateNewTestPlanFromSource(ITestPlan sourcePlan, string newPlanName)
        {
            ITestPlan targetPlan;

            targetPlan = targetTestStore.CreateTestPlan();
            targetPlan.CopyPropertiesFrom(sourcePlan);
            targetPlan.Name        = newPlanName;
            targetPlan.StartDate   = sourcePlan.StartDate;
            targetPlan.EndDate     = sourcePlan.EndDate;
            targetPlan.Description = sourcePlan.Description;

            // Set area and iteration to root of the target project.
            // We will set the correct values later, when we actually have a work item available
            targetPlan.Iteration = engine.Target.Name;
            targetPlan.AreaPath  = engine.Target.Name;

            // Remove testsettings reference because VSTS Sync doesn't support migrating these artifacts
            if (targetPlan.ManualTestSettingsId != 0)
            {
                targetPlan.ManualTestSettingsId    = 0;
                targetPlan.AutomatedTestSettingsId = 0;
                Trace.WriteLine("Ignoring migration of Testsettings. Azure DevOps Migration Tools don't support migration of this artifact type.");
            }

            // Remove reference to build uri because VSTS Sync doesn't support migrating these artifacts
            if (targetPlan.BuildUri != null)
            {
                targetPlan.BuildUri = null;
                Trace.WriteLine(string.Format("Ignoring migration of assigned Build artifact {0}. Azure DevOps Migration Tools don't support migration of this artifact type.", sourcePlan.BuildUri));
            }
            return(targetPlan);
        }
        private ITestPlan CreateNewTestPlanFromSource(ITestPlan sourcePlan, string newPlanName)
        {
            ITestPlan targetPlan;

            targetPlan = targetTestStore.CreateTestPlan();
            targetPlan.CopyPropertiesFrom(sourcePlan);
            targetPlan.Name        = newPlanName;
            targetPlan.StartDate   = sourcePlan.StartDate;
            targetPlan.EndDate     = sourcePlan.EndDate;
            targetPlan.Description = sourcePlan.Description;
            if (config.PrefixProjectToNodes)
            {
                targetPlan.AreaPath  = string.Format(@"{0}\{1}", engine.Target.Name, sourcePlan.AreaPath);
                targetPlan.Iteration = string.Format(@"{0}\{1}", engine.Target.Name, sourcePlan.Iteration);
            }
            else
            {
                var regex = new Regex(Regex.Escape(engine.Source.Name));
                targetPlan.AreaPath  = regex.Replace(sourcePlan.AreaPath, engine.Target.Name, 1);
                targetPlan.Iteration = regex.Replace(sourcePlan.Iteration, engine.Target.Name, 1);
            }
            targetPlan.ManualTestSettingsId = 0;

            return(targetPlan);
        }
        private ITestPlan CreateNewTestPlanFromSource(ITestPlan sourcePlan, string newPlanName)
        {
            ITestPlan targetPlan;

            targetPlan = targetTestStore.CreateTestPlan();
            targetPlan.CopyPropertiesFrom(sourcePlan);
            targetPlan.Name        = newPlanName;
            targetPlan.StartDate   = sourcePlan.StartDate;
            targetPlan.EndDate     = sourcePlan.EndDate;
            targetPlan.Description = sourcePlan.Description;
            if (config.PrefixProjectToNodes)
            {
                targetPlan.AreaPath  = string.Format(@"{0}\{1}", engine.Target.Name, sourcePlan.AreaPath);
                targetPlan.Iteration = string.Format(@"{0}\{1}", engine.Target.Name, sourcePlan.Iteration);
            }
            else
            {
                var regex = new Regex(Regex.Escape(engine.Source.Name));
                targetPlan.AreaPath  = regex.Replace(sourcePlan.AreaPath, engine.Target.Name, 1);
                targetPlan.Iteration = regex.Replace(sourcePlan.Iteration, engine.Target.Name, 1);
            }

            // Remove testsettings reference because VSTS Sync doesnt support migrating these artifacts
            if (targetPlan.ManualTestSettingsId != 0 && targetPlan.ManualTestSettingsId != 0)
            {
                targetPlan.ManualTestSettingsId    = 0;
                targetPlan.AutomatedTestSettingsId = 0;
                Trace.WriteLine("Ignoring migration of Testsettings. VSTS Sync Migration Tools dont support migration of this artifact type.");
            }

            // Remove reference to build uri because VSTS Sync doesnt support migrating these artifacts
            if (targetPlan.BuildUri != null)
            {
                targetPlan.BuildUri = null;
                Trace.WriteLine(string.Format("Ignoring migration of assigned Build artifact {0}. VSTS Sync Migration Tools dont support migration of this artifact type.", sourcePlan.BuildUri));
            }
            return(targetPlan);
        }