public void GenerateWithNullInput() { var expected = JsonResource.IssueInput_Empty; var actual = IssueInputJsonGenerator.Generate(null); Assert.AreEqual(expected, actual.ToJson()); }
public void GenerateWithEmptyInput() { var issueInput = new IssueInput(new Dictionary <string, FieldInput>()); var expected = JsonResource.IssueInput_Empty; var actual = IssueInputJsonGenerator.Generate(issueInput); Assert.AreEqual(expected, actual.ToJson()); }
public void GenerateBasic() { var dict = new Dictionary <string, object> { { "string", "string" }, { "integer", 1 }, { "long", 1L }, { "complex", ComplexIssueInputFieldValue.With("test", "id") } }; var fields = new List <FieldInput> { new FieldInput("string", "String value"), new FieldInput("integer", 1), new FieldInput("long", 1L), new FieldInput("complex", new ComplexIssueInputFieldValue(dict)) }; var issueInput = IssueInput.CreateWithFields(fields); var expected = JsonResource.IssueInput_Valid; var actual = IssueInputJsonGenerator.Generate(issueInput); Assert.AreEqual(expected, actual.ToJson()); }
/// <summary> /// Creates an issue or a subtask. /// </summary> /// <param name="issue">Information about the issue to create. The fields that can be set on issue creation can be determined using the <see cref="IIssueRestClient.GetCreateIssueMetadata()"/> or <see cref="IIssueRestClient.GetCreateIssueMetadata(JIRC.Domain.Input.GetCreateIssueMetadataOptions)"/> methods. /// The <see cref="IssueInputBuilder"/> class can be used to help generate the appropriate fields.</param> /// <seealso cref="IssueInputBuilder"/> /// <returns>Details of the created issue.</returns> /// <exception cref="WebServiceException">The input is invalid (e.g. missing required fields, invalid field values, and so forth), or if the calling user does not have permission to create the issue.</exception> public BasicIssue CreateIssue(IssueInput issue) { var json = IssueInputJsonGenerator.Generate(issue); return(client.Post <BasicIssue>("issue", json)); }