public async Task AddAndRemovePropertyAndVerifyProperties(Jira jira) { var issue = new Issue(jira, "TST") { Type = "1", Summary = "Test issue with properties", Assignee = "admin", }; issue.SaveChanges(); // Verify no properties exist var propertyKeys = await jira.Issues.GetPropertyKeysAsync(issue.Key.Value); Assert.Empty(propertyKeys); // Set new property on issue var keyString = "test-property"; var keyValue = JToken.FromObject("test-string"); await issue.SetPropertyAsync(keyString, keyValue); // Verify one property exists. propertyKeys = await jira.Issues.GetPropertyKeysAsync(issue.Key.Value); Assert.True(propertyKeys.SequenceEqual(new List <string>() { keyString })); // Verify the property key returns the exact value var issueProperties = await issue.GetPropertiesAsync(new[] { keyString, "non-existent-property" }); var truth = new Dictionary <string, JToken>() { { keyString, keyValue }, }; Assert.True(issueProperties.Keys.SequenceEqual(truth.Keys)); Assert.True(issueProperties.Values.SequenceEqual(truth.Values, new JTokenEqualityComparer())); // Delete the property await issue.DeletePropertyAsync(keyString); // Verify dictionary is empty issueProperties = await issue.GetPropertiesAsync(new[] { keyString }); Assert.False(issueProperties.Any()); }
public async Task RemoveInexistantPropertyAndVerifyNoOp(Jira jira) { var issue = new Issue(jira, "TST") { Type = "1", Summary = "Test issue with properties", Assignee = "admin", }; issue.SaveChanges(); var keyString = "test-property-nonexist"; await issue.DeletePropertyAsync(keyString); // Verify the property isn't returned by the service var issueProperties = await issue.GetPropertiesAsync(new[] { keyString }); Assert.False(issueProperties.Any()); }