private static WorkItem GetParent(string Id, WorkItemStore workItemStore)
        {
            WorkItem child      = workItemStore.GetWorkItem(int.Parse(Id));
            var      parentLink = child.WorkItemLinks.Cast <WorkItemLink>().FirstOrDefault(x => x.LinkTypeEnd.Name == "Parent");

            return(parentLink != null?workItemStore.GetWorkItem(parentLink.TargetId) : null);
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            var files = new HashSet <string>();

            foreach (var workItemId in WorkItemNumbers)
            {
                var workItem   = WorkItemStore.GetWorkItem(workItemId);
                var changesets = GetChangesetsForWorkItem(workItem);
                foreach (var changeset in changesets)
                {
                    foreach (var change in changeset.Changes)
                    {
                        var filePath = change.Item.ServerItem;
                        if (!files.Contains(filePath))
                        {
                            files.Add(filePath);
                        }
                    }
                }
            }
            var orderedFiles = files.OrderBy(f => f);

            foreach (var file in orderedFiles)
            {
                var index = file.LastIndexOf('/') + 1;
                Console.WriteLine("{0}/t{1}", file.Substring(index - 1), file.Substring(index));
            }
        }
Exemple #3
0
        /// <summary>
        /// When implemented in a derived class, performs the execution of the activity.
        /// </summary>
        /// <param name="context">The execution context under which the activity executes.</param>
        protected override void Execute(CodeActivityContext context)
        {
            TeamFoundationRequestContext requestContext = context.GetValue(this.TeamFoundationRequestContext);

          #if UsingILocationService
            ILocationService tfLocationService = requestContext.GetService <ILocationService>();
            Uri uriRequestContext = new Uri(tfLocationService.GetLocationData(requestContext, Guid.Empty).GetServerAccessMapping(requestContext).AccessPoint + "/" + requestContext.ServiceHost.Name);
#else
            var tfLocationService = requestContext.GetService <TeamFoundationLocationService>();
            var accessMapping     = tfLocationService.GetServerAccessMapping(requestContext);
            Uri uriRequestContext = new Uri(tfLocationService.GetHostLocation(requestContext, accessMapping));
#endif
            string     strHost = System.Environment.MachineName;
            string     strFQDN = System.Net.Dns.GetHostEntry(strHost).HostName;
            UriBuilder uriBuilderRequestContext = new UriBuilder(uriRequestContext.Scheme, strFQDN, uriRequestContext.Port, uriRequestContext.PathAndQuery);
            string     teamProjectCollectionUrl = uriBuilderRequestContext.Uri.AbsoluteUri;
            var        teamProjectCollection    = new TfsTeamProjectCollection(new Uri(teamProjectCollectionUrl));
            string     serverUri = teamProjectCollectionUrl;

            var           workItemEvent = context.GetValue(this.WorkItemChangedEvent);
            int           workItemId    = workItemEvent.CoreFields.IntegerFields.First(k => k.Name == "ID").NewValue;
            WorkItemStore workItemStore = GetWorkitemStore(serverUri);
            var           workItem      = workItemStore.GetWorkItem(workItemId);

            context.SetValue(this.ChangedFields, workItemEvent.ChangedFields);
            context.SetValue(this.WorkItem, workItem);
            context.SetValue(this.TFSCollectionUrl, serverUri);
        }
        protected override void ProcessRecordInEH()
        {
            WorkItemStore       workItemStore = EnsureWorkItemStore();
            WorkItemLinkTypeEnd linkTypeEnd   = EnsureWorkItemLinkTypeEnd(workItemStore);

            WorkItem[] workItems = QueryFromWorkItems(workItemStore).ToArray();
            if (workItems.Length == 0)
            {
                return;
            }

            WorkItem toWorkItem = workItemStore.GetWorkItem(RelatedWorkItemId);

            if (toWorkItem == null)
            {
                throw new ArgumentException(string.Format("Invalid to work item id: {0}.", RelatedWorkItemId));
            }

            foreach (var workItem in workItems)
            {
                workItem.Links.Add(new RelatedLink(linkTypeEnd, toWorkItem.Id));
                WriteObject(workItem);
            }

            workItemStore.BatchSave(workItems, SaveFlags.MergeLinks);
        }
Exemple #5
0
        public static void connectToTFS()
        {
            // catch the authentication error
            try
            {
                // create the connection to the TFS server
                NetworkCredential netCred = new NetworkCredential(DomainName, Password);
                Microsoft.VisualStudio.Services.Common.WindowsCredential winCred = new Microsoft.VisualStudio.Services.Common.WindowsCredential(netCred);
                VssCredentials           vssCred = new VssCredentials(winCred);
                TfsTeamProjectCollection tpc     = new TfsTeamProjectCollection(new Uri("https://tfs.mtsit.com/STS/"), vssCred);

                tpc.Authenticate();

                workItemStore = tpc.GetService <WorkItemStore>();
                workItem      = workItemStore.GetWorkItem(Program.itemId);

                // create web link for tfs id
                tfsLink = tpc.Uri + workItem.AreaPath.Remove(workItem.AreaPath.IndexOf((char)92)) + "/_workitems/edit/";
                // create path and name to html file
                PathToHtml = PathToTasks + workItem.Type.Name + " " + workItem.Id + ".html";
                // create path and folder name for attachments
                PathToAttach = PathToTasks + workItem.Id;
            }
            catch (Exception ex)
            {
                Program.exExit(ex);
            }
        }
    public override void Run()
    {
        WorkItemStore store     = Driver.TeamFoundationServer.GetService(typeof(WorkItemStore)) as WorkItemStore;
        ILinking      linking   = Driver.TeamFoundationServer.GetService(typeof(ILinking)) as ILinking;
        int           changeSet = 1;

        // Get URI for changeset
        ArtifactId changeSetId = new ArtifactId();

        changeSetId.Tool           = "VersionControl";
        changeSetId.ArtifactType   = "ChangeSet";
        changeSetId.ToolSpecificId = changeSet.ToString();
        string changeSetUri = LinkingUtilities.EncodeUri(changeSetId);

        // Get referencing artifacts for given changeset
        Artifact[] artifacts = linking.GetReferencingArtifacts(new string[] { changeSetUri }, null);

        foreach (Artifact artifact in artifacts)
        {
            Console.WriteLine(artifact.ToString());
            ArtifactId artifactId = LinkingUtilities.DecodeUri(artifact.Uri);
            if (String.Equals(artifactId.Tool, "WorkItemTracking", StringComparison.OrdinalIgnoreCase))
            {
                WorkItem wi = store.GetWorkItem(Convert.ToInt32(artifactId.ToolSpecificId));
                Console.WriteLine(wi);
            }
        }
    }
Exemple #7
0
 public void AddTestCasesToSuite(IEnumerable <ITestCase> testCases, ITestSuiteBase destinationSuite)
 {
     if (destinationSuite.TestSuiteType == TestSuiteType.StaticTestSuite)
     {
         IStaticTestSuite staticTestSuite = destinationSuite as IStaticTestSuite;
         if (staticTestSuite != null)
         {
             staticTestSuite.Entries.AddCases(testCases);
         }
     }
     else if (destinationSuite.TestSuiteType == TestSuiteType.RequirementTestSuite)
     {
         IRequirementTestSuite requirementTestSuite = destinationSuite as IRequirementTestSuite;
         if (requirementTestSuite != null)
         {
             WorkItemStore store          = requirementTestSuite.Project.WitProject.Store;
             WorkItem      tfsRequirement = store.GetWorkItem(requirementTestSuite.RequirementId);
             foreach (ITestCase testCase in testCases)
             {
                 tfsRequirement.Links.Add(new RelatedLink(store.WorkItemLinkTypes.LinkTypeEnds["Tested By"],
                                                          testCase.WorkItem.Id));
             }
             tfsRequirement.Save();
         }
     }
     destinationSuite.Plan.Save();
 }
Exemple #8
0
        /// <summary>
        ///     Create Palylist with selected test cases
        /// </summary>
        /// <param name="selectedTcId"></param>
        /// <param name="fileLocation"></param>
        public static void CreatePlaylist(List <int> selectedTcId, string fileLocation)
        {
            Stp.Restart();
            string automatedTestName, playlistFileContent = "<Playlist Version=\"1.0\">";
            var    automatedTestList = new ConcurrentBag <string>();

            automatedTestList.AsParallel();
            Parallel.ForEach(selectedTcId, testcaseId =>
            {
                var pt            = _tfsStore.GetWorkItem(testcaseId);
                automatedTestName = pt.Fields["Automated Test Name"].Value.ToString();
                lock (automatedTestList)
                {
                    automatedTestList.Add(automatedTestName);
                }
            });
            var dedup = automatedTestList.Distinct().ToList();

            Stp.Stop();
            AutomationMethodTime = (float)Stp.ElapsedMilliseconds / 1000;
            Stp.Restart();
            playlistFileContent = dedup.Aggregate(playlistFileContent, (current, testName) => current + "<Add Test=\"" + testName + "\" />");

            playlistFileContent += "</Playlist>";
            var fs = new FileStream(fileLocation, FileMode.Create);

            using (var writer = new StreamWriter(fs))
            {
                writer.WriteLine(playlistFileContent);
            }
            fs.Dispose();
            Stp.Stop();
            AutomationPlaylistAddition = (float)Stp.ElapsedMilliseconds / 1000;
        }
        public override void AddLinkToWorkItem(int parentId, int childWorkItemId, string comment)
        {
            using (var tfsProjectCollection = GetProjectCollection())
            {
                var workItemStore  = new WorkItemStore(tfsProjectCollection);
                var parentWorkItem = workItemStore.GetWorkItem(parentId);
                var linked         = false;

                // Update if there's an existing link already
                foreach (var link in parentWorkItem.Links)
                {
                    var relatedLink = link as RelatedLink;
                    if (relatedLink != null && relatedLink.RelatedWorkItemId == childWorkItemId)
                    {
                        relatedLink.Comment = comment;
                        linked = true;
                    }
                }

                if (!linked)
                {
                    parentWorkItem.Links.Add(new RelatedLink(childWorkItemId)
                    {
                        Comment = comment
                    });
                }

                parentWorkItem.Validate();
                parentWorkItem.Save();
            }
        }
Exemple #10
0
        static void Main(string[] args)
        {
            int UserStoryID = 53;
            int TestCaseID  = 54;

            TfsTeamProjectCollection tfs;

            tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://ictfs2015:8080/tfs/DefaultCollection"));
            tfs.Authenticate();

            var      workItemStore = new WorkItemStore(tfs);
            WorkItem wit           = workItemStore.GetWorkItem(UserStoryID);

            //Set "Tested By" as the link type
            var linkTypes = workItemStore.WorkItemLinkTypes;
            WorkItemLinkType    testedBy    = linkTypes.FirstOrDefault(lt => lt.ForwardEnd.Name == "Tested By");
            WorkItemLinkTypeEnd linkTypeEnd = testedBy.ForwardEnd;

            //Add the link as related link.
            try
            {
                wit.Links.Add(new RelatedLink(linkTypeEnd, TestCaseID));
                wit.Save();
                Console.WriteLine(string.Format("Linked TestCase {0} to UserStory {1}", TestCaseID, UserStoryID));
            }
            catch (Exception ex)
            {
                // ignore "duplicate link" errors
                if (!ex.Message.StartsWith("TF26181"))
                {
                    Console.WriteLine("ex: " + ex.Message);
                }
            }
            Console.ReadLine();
        }
Exemple #11
0
        public IEnumerable <ChangeSetDetails> GetInfo(int workItemId)
        {
            this.WorkItemId    = workItemId;
            this.ChangeSets    = new List <ChangeSetDetails>();
            this.TfsChangeSets = new List <Changeset>();

            WorkItem = _workItemStore.GetWorkItem(workItemId);
            if (WorkItem == null)
            {
                throw new NullReferenceException("WorkItem");
            }

            this.Downloader.WorkItem = this.WorkItem;

            if (0 == WorkItem.ExternalLinkCount)
            {
                return(ChangeSets);
            }

            var links = WorkItem.Links.OfType <ExternalLink>().AsEnumerable();

            foreach (var link in links)
            {
                var tfsChangeSet = _versionControl.ArtifactProvider.GetChangeset(new Uri(link.LinkedArtifactUri));
                this.TfsChangeSets.Add(tfsChangeSet);
                var cs = CreateChangeSet(tfsChangeSet);

                ((List <ChangeSetDetails>) this.ChangeSets).Add(cs);
            }

            this.Downloader.Changesets = this.TfsChangeSets;

            return(this.ChangeSets);
        }
 public WorkItem GetWorkItem(IssueMigration issueMigration)
 {
     Logger.Debug("Get work item {migration}", (jiraId: issueMigration.IssueId.ToString(), wiId: issueMigration.WorkItemId));
     return(issueMigration.WorkItemId == default
         ? GetWorkItem(issueMigration.IssueId)
         : _workItemStore.GetWorkItem(issueMigration.WorkItemId));
 }
Exemple #13
0
        private WorkItem GetSelectedWorkItem()
        {
            WorkItem workItem = null;

            try
            {
                if (rbCreateNewWorkItem.Checked)
                {
                    workItem = new WorkItem(workItemTypeCollection[cmbWorkItemType.Text]);
                }
                else if (rbAddToExistingWorkItem.Checked)
                {
                    try
                    {
                        workItem = wis.GetWorkItem(int.Parse(txtWorkItemId.Text));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, Cropper.TFSWorkItem.TFS.PluginDescription, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Cropper.TFSWorkItem.TFS.PluginDescription, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(workItem);
        }
Exemple #14
0
        public static int getChildEffort(WorkItem wi, WorkItemStore workItemStore)
        {
            WorkItemLinkCollection linkWorkItem = wi.WorkItemLinks;
            int           comEffort             = 0;
            StringBuilder childId = new StringBuilder();

            foreach (WorkItemLink wil in linkWorkItem)
            {
                if (wil.LinkTypeEnd.Name.Equals("Child"))
                {
                    WorkItem childWI = workItemStore.GetWorkItem(wil.TargetId);
                    childId = childId.Append((childWI.Id).ToString()).Append("*");
                    if ("Task".Equals(childWI.Type.Name))
                    {
                        int      childRevs = childWI.Revision;
                        Revision childRev  = childWI.Revisions[childRevs - 1];
                        comEffort = comEffort + Convert.ToInt32(childRev.Fields["Completed work"].Value);
                    }
                    else
                    {
                        comEffort = comEffort + getChildEffort(childWI, workItemStore);
                    }
                }
            }
            return(comEffort);
        }
Exemple #15
0
        /// <summary>
        ///     Gets the real instance.
        /// </summary>
        /// <returns>WorkItemLinkCollection.</returns>
        public static WorkItemLinkCollection GetRealInstance()
        {
            WorkItemStore workItemStore = WorkItemStoreWrapper_UnitTests.GetRealInstance();
            WorkItem      workitem      = workItemStore.GetWorkItem(195);

            return(workitem.WorkItemLinkHistory);
        }
Exemple #16
0
        public static IEnumerable <WorkItemDto> GetWorkItemsFromTeamBuilds(this TfsConfigurationServer tfsConfigurationServer, Guid teamProjectCollectionId, IEnumerable <WorkItemSummaryDto> workItems)
        {
            if (tfsConfigurationServer == null)
            {
                throw new ArgumentNullException("tfsConfigurationServer");
            }

            if (workItems == null)
            {
                throw new ArgumentNullException("workItems");
            }

            TfsTeamProjectCollection tfsTeamProjectCollection = tfsConfigurationServer.GetTeamProjectCollection(teamProjectCollectionId);
            WorkItemStore            workItemStore            = tfsTeamProjectCollection.GetService <WorkItemStore>();
            WorkItemDtoCollection    workItemDtoCollection    = new WorkItemDtoCollection();

            foreach (WorkItemSummaryDto workItemSummaryDto in workItems)
            {
                WorkItem    workItem    = workItemStore.GetWorkItem(workItemSummaryDto.Id);
                WorkItemDto workItemDto = WorkItemDto.CreateFromWorkItem(workItem, workItemSummaryDto.AssociatedBuildNumber);
                workItemDtoCollection.Add(workItemDto);
            }

            return(workItemDtoCollection);
        }
 private void txtWorkItemId_KeyDown(object sender, KeyEventArgs e)
 {
     if ((e.KeyCode == Keys.Return) && ((TextBox)sender).Text != string.Empty)
     {
         try
         {
             var workItemId = int.Parse(((TextBox)sender).Text);
             var workItem   = _workItemStore.GetWorkItem(workItemId);
             if (workItem != null)
             {
                 rtxtLog.AppendText("Retrived Work-Item ID: " + workItem.Id + " From Project: " + workItem.Project.Name, Color.Green);
                 rtxtLog.AppendText(Environment.NewLine);
                 dgvWorkItemsQueryResult.DataSource = new List <object>
                 {
                     new
                     {
                         ID   = workItem.Id,
                         Type = workItem.Type.Name,
                         workItem.Title,
                         workItem.State,
                         IterationPath = workItem.Fields["Iteration Path"].Value,
                         workItem.History
                     }
                 };
             }
         }
         catch (Exception exception)
         {
             rtxtLog.AppendTextWithNewLine(Utilities.ReadException(exception), Color.Red);
         }
     }
 }
 private void Rebuild(WorkItemStore targetStore)
 {
     foreach (int targetId in this.BackwardIndex.Keys)
     {
         var targetWorkItem = targetStore.GetWorkItem(targetId);
         this.TargetIndex.Add(targetId, targetWorkItem);
     }
 }
Exemple #19
0
 public WorkItem GetWorkItem(int Id)
 {
     if (_workItemStore == null)
     {
         throw new InvalidOperationException("Attempt to get work items before connecting.");
     }
     return(_workItemStore.GetWorkItem(Id));
 }
Exemple #20
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            Uri uri = new Uri(TfsUri);

            TeamFoundationDiscussionService service = new TeamFoundationDiscussionService();

            service.Initialize(new TfsTeamProjectCollection(uri));

            TfsTeamProjectCollection projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(uri);

            WorkItemStore store = projectCollection.GetService <WorkItemStore>();

            WorkItemLinkInfo[] list = GetCodeReviewRequests(store);

            IDiscussionManager discussionManager = service.CreateDiscussionManager();

            List <ResponseAnalysis> responseList = new List <ResponseAnalysis>();

            List <WorkItemLinkInfo> filteredList = list.Where(p => p.SourceId != 0).ToList();

            foreach (WorkItemLinkInfo item in filteredList)
            {
                ResponseAnalysis response = new ResponseAnalysis();

                WorkItem Widemand   = store.GetWorkItem(item.SourceId);
                WorkItem WiResponse = store.GetWorkItem(item.TargetId);

                string reviewer = WiResponse.Fields["Accepted By"].Value.ToString();

                string date = Widemand.Fields["Created Date"].Value.ToString();

                response.WorkiTemId       = Widemand.Id;
                response.CommentNumber    = CountComments(Widemand.Id, discussionManager, NormalizeName(reviewer));
                response.OwnerName        = Widemand.CreatedBy;
                response.CodeReviewStatus = WiResponse.Fields["Closed Status"].Value.ToString();
                response.Direction        = GetDirection(Widemand.CreatedBy);
                response.ReviewerName     = reviewer;
                response.Team             = GetTeam(Widemand.CreatedBy);

                //WorkItemType type = item.Links.WorkItem.Type;

                responseList.Add(response);
            }

            int nbConcernedLines = 0;
        }
Exemple #21
0
        private static int AddChild(
            WorkItemStore store,
            Dictionary <string, IterationInfo> iterations,
            Dictionary <int, Task> tasks,
            Task parentTask,
            int workItemId,
            int index)
        {
            var  childWorkItem = store.GetWorkItem(workItemId);
            Task new_task;

            try
            {
                new_task = (index >= Globals.ThisAddIn.Application.ActiveProject.Tasks.Count)
                    ? Globals.ThisAddIn.Application.ActiveProject.Tasks.Add(childWorkItem.Title)
                    : Globals.ThisAddIn.Application.ActiveProject.Tasks.Add(childWorkItem.Title, index);
            }
            catch (Exception ex)
            {
                Globals.ThisAddIn.Application.Message(
                    ex.Message + " at add work item " + workItemId,
                    PjMessageType.pjOKOnly);
                return(0);
            }

            new_task.Text1 = workItemId.ToString();
            while (new_task.OutlineLevel < parentTask.OutlineLevel + 1)
            {
                new_task.OutlineIndent();
            }

            while (new_task.OutlineLevel > parentTask.OutlineLevel + 1)
            {
                new_task.OutlineOutdent();
            }

            UpdateTask(new_task, childWorkItem, iterations);
            tasks.Add(workItemId, new_task);

            int result = 1;

            foreach (Link itemLink in childWorkItem.Links)
            {
                if (itemLink.ArtifactLinkType.Name == "Related Workitem" &&
                    ((RelatedLink)itemLink).LinkTypeEnd.ImmutableName ==
                    "System.LinkTypes.Hierarchy-Forward")
                {
                    if (!tasks.ContainsKey(((RelatedLink)itemLink).RelatedWorkItemId))
                    {
                        result += AddChild(store, iterations, tasks, new_task, ((RelatedLink)itemLink).RelatedWorkItemId, index + result);
                    }
                }
            }

            return(result);
        }
        private static List <WorkItem> GetChilds(WorkItem parentWorkItem, WorkItemStore workItemInstance)
        {
            var childLinks = parentWorkItem?.WorkItemLinks.Cast <WorkItemLink>().Where(x => x.LinkTypeEnd.Name == "Child");

            if (childLinks != null)
            {
                return(childLinks.Select(childLink => workItemInstance.GetWorkItem(childLink.TargetId)).ToList());
            }
            return(new List <WorkItem>());
        }
        public void GetWorkItem_ById_Succeeds()
        {
            var context = new EngineContext(client, projectId, projectName, personalAccessToken, logger);
            var sut     = new WorkItemStore(context);

            var wi = sut.GetWorkItem(42);

            Assert.NotNull(wi);
            Assert.Equal(42, wi.Id.Value);
        }
        private void GetItemInfo(WorkItemInfo item, WorkItemStore store, bool isRequirement = true)
        {
            var workItem = store.GetWorkItem(item.Id);

            item.Title = workItem.Title;
            if (isRequirement)
            {
                item.MatrixState = workItem.State;
            }
        }
Exemple #25
0
        /// <summary>
        /// Return a IWITDiffItem representing a single work item as identified by the adapter specific workItemId string
        /// </summary>
        /// <param name="workItemId"></param>
        /// <returns></returns>
        public IWITDiffItem GetWITDiffItem(string workItemIdStr)
        {
            IWITDiffItem tfsWitDiffItem = null;
            int          workItemId;

            if (int.TryParse(workItemIdStr, out workItemId))
            {
                try
                {
                    WorkItem workItem = m_workItemStore.GetWorkItem(workItemId);
                    tfsWitDiffItem = new TfsWITDiffItem(this, workItem);
                }
                catch (DeniedOrNotExistException)
                {
                    // Treat this as not found rather than an Exception so that processing continues
                    return(null);
                }
            }
            return(tfsWitDiffItem);
        }
        private WorkItem GetWorkItemById(WorkItemStore workItemStore, string id)
        {
            WorkItem result = null;

            if (int.TryParse(id, out int int_id))
            {
                result = workItemStore.GetWorkItem(int_id);
            }

            return(result);
        }
Exemple #27
0
        static void Main(string[] args)
        {
            var url         = $"https://dev.azure.com/{Properties.Settings.Default.Org}";
            var credentials = new VssBasicCredential("", Properties.Settings.Default.PAT);
            TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(url, UriKind.Absolute), credentials);
            var TFSWorkItemStore         = new WorkItemStore(tfs);
            var item = TFSWorkItemStore.GetWorkItem(Properties.Settings.Default.Workitem);

            Console.WriteLine($"Created By: {item.CreatedBy}");
            Console.WriteLine($"ID: {item.Id}");
        }
Exemple #28
0
 public bool SomeWorkIsDone(WorkItem workItem)
 {
     foreach (RelatedLink link in workItem.Links)
     {
         var oppositeItem = WorkItemStore.GetWorkItem(link.RelatedWorkItemId);
         if (link.LinkTypeEnd.Name == "Child" && oppositeItem.Type.Name == "Task" && oppositeItem.State == "Завершён")
         {
             return(true);
         }
     }
     return(false);
 }
        public static WorkItem GetTfsWorkItem(
            TfsTeamProjectCollection collection,
            string projectName,
            int workItemId)
        {
            collection.EnsureAuthenticated();

            WorkItemStore workitemstore = collection.GetService <WorkItemStore>();
            WorkItem      item          = workitemstore.GetWorkItem(workItemId);

            return(item);
        }
Exemple #30
0
        public static WorkItem GetWorkItem(string uri, int testedWorkItemId)
        {
            TfsTeamProjectCollection tfs;

            tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(uri));             // https://mytfs.visualstudio.com/DefaultCollection
            tfs.Authenticate();
            var      workItemStore = new WorkItemStore(tfs);
            WorkItem workItem      = workItemStore.GetWorkItem(testedWorkItemId);

            workItem.History.Insert(0, "");
            return(workItem);
        }