TFS 2010 工作项 - 工作项链接
当用户从测试用例中打开错误时,我需要检查测试用例是否链接到需求项,如果是,我需要将错误链接到需求项。
我怎样才能知道这些信息?
我使用以下代码:
WorkItemLinkCollection links = _workItem.WorkItemLinks;
foreach (WorkItemLink link in links)
{
}
但我不知道如何获取链接类型和链接 id。
When a user opens a bug from a test case, I need to check if the test case is linked to a requirement item and if so I need to link the bug to the requirement item.
How can I know this information?
I use following piece of code:
WorkItemLinkCollection links = _workItem.WorkItemLinks;
foreach (WorkItemLink link in links)
{
}
but I don't know how to get the link type and link id.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WorkItemLink 是一个抽象基类。 ExternalLink、HyperLink 和RelatedLink 继承自它,因此链接实例将是这些类型之一。因此,请检查实例的类型或使用“is”进行测试。您还可以获取 RegisteredLink 属性,该属性获取链接类型的友好名称。
有关详细信息,请参阅 http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.link(v=vs.80).aspx
关于 id它涉及到,每种类型都与不同的事物相关。例如,RelatedLink 类型有一个RelatedWorkItemId 属性,该属性返回与该工作项相关的工作项的ID。源 id 是链接集合所在的工作项的 id。
http:// msdn.microsoft.com/en-US/library/microsoft.teamfoundation.workitemtracking.client.latedlink_members(v=VS.80).aspx
但是,超链接与另一个工作项无关 - 它有一个位置属性来获取字符串形式的超链接位置。
http:// msdn.microsoft.com/en-US/library/microsoft.teamfoundation.workitemtracking.client.hyperlink_members(v=VS.80).aspx
WorkItemLink is an abstract base class. ExternalLink, HyperLink, and RelatedLink inherit from it so the link instance will be one of those types. So, check the type of your instance or test it with 'is'. You can also get the RegisteredLink property which gets the friendly name of the link type.
For more info see http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.link(v=vs.80).aspx
Concerning the id that it's related to, each type is related to something different. For example, the RelatedLink type has a RelatedWorkItemId property which returns the id of the workitem that this workitem is related to. The source id is the id of the workitem that the link collection is on.
http://msdn.microsoft.com/en-US/library/microsoft.teamfoundation.workitemtracking.client.relatedlink_members(v=VS.80).aspx
But, a hyperlink link isn't related to another workitem - it has a location property to get the hyperlink location as a string.
http://msdn.microsoft.com/en-US/library/microsoft.teamfoundation.workitemtracking.client.hyperlink_members(v=VS.80).aspx