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 ?
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();