0

I could get a test case object using TFS API.Now i want to link a task id(e.g. 435567) to this Test Case object's "Affected By" link type. Any sample code available to do this ?

I could see there is an add method for the testcase like below , but it doesnt task id as the parameter.

 testCase.WorkItem.WorkItemLinks.Add(<Microsoft.TeamFoundation.WorkItemTracking.Client.workitemlink.link >)

any idea how to link the taskid here ?

krrishna
  • 2,050
  • 4
  • 47
  • 101

1 Answers1

3

This blog post will help you. It creates a new user story with some test cases.

var testedByLink = wiStore.WorkItemLinkTypes["Microsoft.VSTS.Common.TestedBy"];
wiUserStory.WorkItemLinks.Add(new WorkItemLink(testedByLink.ForwardEnd, wiTestCase.Id));
wiUserStory.Save();
Ewald Hofman
  • 12,688
  • 3
  • 39
  • 44