public TFSWorkItem GetWorkItem(string wid) { var wiRequest = new RestRequest("exSILentiaProducts/_apis/wit/workitems/{wid}", Method.GET); wiRequest.AddUrlSegment("wid", wid); TFSWorkItem wiItem = Execute <TFSWorkItem>(wiRequest); return(wiItem); }
public bool PatchWorkItem(string wid, PatchWorkItem patchWorkItem) { var wiPatchRequest = new RestRequest("exSILentiaProducts/_apis/wit/workitems/{wid}?api-version=1.0", Method.PATCH); wiPatchRequest.AddUrlSegment("wid", wid); wiPatchRequest.AddHeader("Content-Type", "application/json-patch+json"); wiPatchRequest.AddParameter("undefined", CreatePatchBody(patchWorkItem), ParameterType.RequestBody); TFSWorkItem wiItem = Execute <TFSWorkItem>(wiPatchRequest); return(true); }
public void ReadyForTestToReadyForTest() { // Get Trello cards that are in ready to test List <TrelloCard> rdyTestCards = _trelloApi.GetListCards(TrelloListNames.READYFORTEST); //For each card, set the TFS status to 'ready to test' foreach (TrelloCard card in rdyTestCards) { //Get card id String tfsID = GetCardTFSId(card); TFSWorkItem wi = _tfsApi.GetWorkItem(tfsID); //Check the status in tfs. The status should be "committed", if not, set it if possible, if (wi.fields.State != "Ready for Test") { _tfsApi.PatchWorkItem(wi.id, PatchWorkItem.CreateReadyForTestWorkItemPatch()); } } }
public void DevCompleteToCommitted() { // Get Trello cards that are in dev complete List <TrelloCard> devCompleteCards = _trelloApi.GetListCards(TrelloListNames.DEVELOPMENTCOMPLETE); //For each card, set the TFS status to 'committed' foreach (TrelloCard card in devCompleteCards) { //Get card id String tfsID = GetCardTFSId(card); TFSWorkItem wi = _tfsApi.GetWorkItem(tfsID); //Check the status in tfs. The status should be "committed", if not, set it if possible, if (wi.fields.State != "Committed") { //Can't go directly from Test -> Committed, have to set the status to new first if (wi.fields.State == "Ready for Test") { _tfsApi.PatchWorkItem(wi.id, PatchWorkItem.CreateNewWorkItemPatch()); } _tfsApi.PatchWorkItem(wi.id, PatchWorkItem.CreateCommittedWorkItemPatch()); } } }