public void Assign() { JiraAssignee assign = new JiraAssignee { AccountId = "5ea963ee9ce9ee0b8943fed2", IssueIdOrKey = "DW-6" }; HttpStatusCode actualStatusCode = IssueSteps.Assign(assign).Status; HttpStatusCode expectedStatusCode = HttpStatusCode.NoContent; Assert.AreEqual(expectedStatusCode, actualStatusCode); }
public static JiraResult Assign(JiraCredentials Credentials, JiraAssignee Assign) { try { var DataObj = new { accountId = Assign.AccountId }; string data = JsonConvert.SerializeObject(DataObj); var content = new StringContent(data, Encoding.UTF8, "application/json"); var response = new Utility().GetClient(Credentials).PutAsync($"issue/{Assign.IssueIdOrKey}/assignee", content).Result; var responseString = response.Content.ReadAsStringAsync().Result; return(new JiraResult { Message = response.StatusCode != HttpStatusCode.NoContent ? responseString : string.Empty, Status = response.StatusCode, Data = response.StatusCode == HttpStatusCode.NoContent? responseString : string.Empty }); } catch (Exception ex) { throw ex; } }