mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 14:15:12 +00:00
Make Issue readonly and fix a bug
Found a bug in which we were using Name when we should be using Login.
This commit is contained in:
267
Octokit.Tests/Models/IssueTest.cs
Normal file
267
Octokit.Tests/Models/IssueTest.cs
Normal file
@@ -0,0 +1,267 @@
|
||||
using System.Linq;
|
||||
using Octokit;
|
||||
using Octokit.Internal;
|
||||
using Xunit;
|
||||
|
||||
public class IssueTest
|
||||
{
|
||||
[Fact]
|
||||
public void CanBeDeserialized()
|
||||
{
|
||||
const string json = @"{
|
||||
""id"": 1,
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/issues/1347"",
|
||||
""html_url"": ""https://github.com/octocat/Hello-World/issues/1347"",
|
||||
""number"": 1347,
|
||||
""state"": ""open"",
|
||||
""title"": ""Found a bug"",
|
||||
""body"": ""I'm having a problem with this."",
|
||||
""user"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
},
|
||||
""labels"": [
|
||||
{
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/labels/bug"",
|
||||
""name"": ""bug"",
|
||||
""color"": ""f29513""
|
||||
}
|
||||
],
|
||||
""assignee"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
},
|
||||
""milestone"": {
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/milestones/1"",
|
||||
""number"": 1,
|
||||
""state"": ""open"",
|
||||
""title"": ""v1.0"",
|
||||
""description"": """",
|
||||
""creator"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
},
|
||||
""open_issues"": 4,
|
||||
""closed_issues"": 8,
|
||||
""created_at"": ""2011-04-10T20:09:31Z"",
|
||||
""updated_at"": ""2014-03-03T18:58:10Z"",
|
||||
""closed_at"": ""2013-02-12T13:22:01Z"",
|
||||
""due_on"": null
|
||||
},
|
||||
""comments"": 0,
|
||||
""pull_request"": {
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/pulls/1347"",
|
||||
""html_url"": ""https://github.com/octocat/Hello-World/pull/1347"",
|
||||
""diff_url"": ""https://github.com/octocat/Hello-World/pull/1347.diff"",
|
||||
""patch_url"": ""https://github.com/octocat/Hello-World/pull/1347.patch""
|
||||
},
|
||||
""closed_at"": null,
|
||||
""created_at"": ""2011-04-22T13:33:48Z"",
|
||||
""updated_at"": ""2011-04-22T13:33:48Z"",
|
||||
""closed_by"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
}
|
||||
}";
|
||||
var serializer = new SimpleJsonSerializer();
|
||||
|
||||
var issue = serializer.Deserialize<Issue>(json);
|
||||
|
||||
Assert.Equal(1347, issue.Number);
|
||||
Assert.Equal("octocat", issue.User.Login);
|
||||
Assert.Equal("bug", issue.Labels.First().Name);
|
||||
}
|
||||
|
||||
public class TheToUpdateMethod
|
||||
{
|
||||
[Fact]
|
||||
public void CreatesAnIssueUpdateRequestObject()
|
||||
{
|
||||
const string json = @"{
|
||||
""id"": 1,
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/issues/1347"",
|
||||
""html_url"": ""https://github.com/octocat/Hello-World/issues/1347"",
|
||||
""number"": 1347,
|
||||
""state"": ""open"",
|
||||
""title"": ""Found a bug"",
|
||||
""body"": ""I'm having a problem with this."",
|
||||
""user"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
},
|
||||
""labels"": [
|
||||
{
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/labels/bug"",
|
||||
""name"": ""bug"",
|
||||
""color"": ""f29513""
|
||||
}
|
||||
],
|
||||
""assignee"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
},
|
||||
""milestone"": {
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/milestones/1"",
|
||||
""number"": 1,
|
||||
""state"": ""open"",
|
||||
""title"": ""v1.0"",
|
||||
""description"": """",
|
||||
""creator"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
},
|
||||
""open_issues"": 4,
|
||||
""closed_issues"": 8,
|
||||
""created_at"": ""2011-04-10T20:09:31Z"",
|
||||
""updated_at"": ""2014-03-03T18:58:10Z"",
|
||||
""closed_at"": ""2013-02-12T13:22:01Z"",
|
||||
""due_on"": null
|
||||
},
|
||||
""comments"": 0,
|
||||
""pull_request"": {
|
||||
""url"": ""https://api.github.com/repos/octocat/Hello-World/pulls/1347"",
|
||||
""html_url"": ""https://github.com/octocat/Hello-World/pull/1347"",
|
||||
""diff_url"": ""https://github.com/octocat/Hello-World/pull/1347.diff"",
|
||||
""patch_url"": ""https://github.com/octocat/Hello-World/pull/1347.patch""
|
||||
},
|
||||
""closed_at"": null,
|
||||
""created_at"": ""2011-04-22T13:33:48Z"",
|
||||
""updated_at"": ""2011-04-22T13:33:48Z"",
|
||||
""closed_by"": {
|
||||
""login"": ""octocat"",
|
||||
""id"": 1,
|
||||
""avatar_url"": ""https://github.com/images/error/octocat_happy.gif"",
|
||||
""gravatar_id"": """",
|
||||
""url"": ""https://api.github.com/users/octocat"",
|
||||
""html_url"": ""https://github.com/octocat"",
|
||||
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||
""type"": ""User"",
|
||||
""site_admin"": false
|
||||
}
|
||||
}";
|
||||
var serializer = new SimpleJsonSerializer();
|
||||
var issue = serializer.Deserialize<Issue>(json);
|
||||
|
||||
var update = issue.ToUpdate();
|
||||
|
||||
Assert.Equal("bug", update.Labels.Single());
|
||||
Assert.Equal(1, update.Milestone.GetValueOrDefault());
|
||||
Assert.Equal("octocat", update.Assignee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
<Compile Include="Models\DeploymentStatusTests.cs" />
|
||||
<Compile Include="Models\DeploymentTests.cs" />
|
||||
<Compile Include="Models\IssueRequestTests.cs" />
|
||||
<Compile Include="Models\IssueTest.cs" />
|
||||
<Compile Include="Models\MilestoneRequestTests.cs" />
|
||||
<Compile Include="Models\ModelExtensionsTests.cs" />
|
||||
<Compile Include="Models\NewReferenceTests.cs" />
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
<Compile Include="Models\DeploymentStatusTests.cs" />
|
||||
<Compile Include="Models\DeploymentTests.cs" />
|
||||
<Compile Include="Models\IssueRequestTests.cs" />
|
||||
<Compile Include="Models\IssueTest.cs" />
|
||||
<Compile Include="Models\MilestoneRequestTests.cs" />
|
||||
<Compile Include="Models\ModelExtensionsTests.cs" />
|
||||
<Compile Include="Models\NewReferenceTests.cs" />
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
<Compile Include="Http\RequestTests.cs" />
|
||||
<Compile Include="Models\DeploymentStatusTests.cs" />
|
||||
<Compile Include="Models\DeploymentTests.cs" />
|
||||
<Compile Include="Models\IssueTest.cs" />
|
||||
<Compile Include="Models\NewReferenceTests.cs" />
|
||||
<Compile Include="Models\MilestoneRequestTests.cs" />
|
||||
<Compile Include="Models\IssueRequestTests.cs" />
|
||||
|
||||
@@ -9,8 +9,8 @@ using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
public class ObservableIssuesClientTests
|
||||
{
|
||||
public class ObservableIssuesClientTests
|
||||
{
|
||||
public class TheGetMethod
|
||||
{
|
||||
[Fact]
|
||||
@@ -48,9 +48,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 1},
|
||||
new Issue {Number = 2},
|
||||
new Issue {Number = 3},
|
||||
CreateIssue(1),
|
||||
CreateIssue(2),
|
||||
CreateIssue(3)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(firstPageLinks)
|
||||
};
|
||||
@@ -60,9 +60,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 4},
|
||||
new Issue {Number = 5},
|
||||
new Issue {Number = 6},
|
||||
CreateIssue(4),
|
||||
CreateIssue(5),
|
||||
CreateIssue(6)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(secondPageLinks)
|
||||
};
|
||||
@@ -70,7 +70,7 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 7},
|
||||
CreateIssue(7),
|
||||
},
|
||||
ApiInfo = CreateApiInfo(new Dictionary<string, Uri>())
|
||||
};
|
||||
@@ -109,10 +109,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 1},
|
||||
new Issue {Number = 2},
|
||||
new Issue {Number = 3},
|
||||
},
|
||||
CreateIssue(1),
|
||||
CreateIssue(2),
|
||||
CreateIssue(3) },
|
||||
ApiInfo = CreateApiInfo(firstPageLinks)
|
||||
};
|
||||
var thirdPageUrl = new Uri("https://example.com/page/3");
|
||||
@@ -121,9 +120,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 4},
|
||||
new Issue {Number = 5},
|
||||
new Issue {Number = 6},
|
||||
CreateIssue(4),
|
||||
CreateIssue(5),
|
||||
CreateIssue(6)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(secondPageLinks)
|
||||
};
|
||||
@@ -131,7 +130,7 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 7},
|
||||
CreateIssue(7)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(new Dictionary<string, Uri>())
|
||||
};
|
||||
@@ -170,9 +169,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 1},
|
||||
new Issue {Number = 2},
|
||||
new Issue {Number = 3},
|
||||
CreateIssue(1),
|
||||
CreateIssue(2),
|
||||
CreateIssue(3)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(firstPageLinks)
|
||||
};
|
||||
@@ -182,9 +181,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 4},
|
||||
new Issue {Number = 5},
|
||||
new Issue {Number = 6},
|
||||
CreateIssue(4),
|
||||
CreateIssue(5),
|
||||
CreateIssue(6)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(secondPageLinks)
|
||||
};
|
||||
@@ -192,7 +191,7 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 7},
|
||||
CreateIssue(7)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(new Dictionary<string, Uri>())
|
||||
};
|
||||
@@ -231,9 +230,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 1},
|
||||
new Issue {Number = 2},
|
||||
new Issue {Number = 3},
|
||||
CreateIssue(1),
|
||||
CreateIssue(2),
|
||||
CreateIssue(3)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(firstPageLinks)
|
||||
};
|
||||
@@ -243,9 +242,9 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 4},
|
||||
new Issue {Number = 5},
|
||||
new Issue {Number = 6},
|
||||
CreateIssue(4),
|
||||
CreateIssue(5),
|
||||
CreateIssue(6)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(secondPageLinks)
|
||||
};
|
||||
@@ -253,7 +252,7 @@ using Xunit;
|
||||
{
|
||||
BodyAsObject = new List<Issue>
|
||||
{
|
||||
new Issue {Number = 7},
|
||||
CreateIssue(7)
|
||||
},
|
||||
ApiInfo = CreateApiInfo(new Dictionary<string, Uri>())
|
||||
};
|
||||
@@ -349,4 +348,10 @@ using Xunit;
|
||||
{
|
||||
return new ApiInfo(links, new List<string>(), new List<string>(), "etag", new RateLimit(new Dictionary<string, string>()));
|
||||
}
|
||||
|
||||
static Issue CreateIssue(int issueNumber)
|
||||
{
|
||||
var serializer = new SimpleJsonSerializer();
|
||||
return serializer.Deserialize<Issue>(@"{""number"": """ + issueNumber + @"""}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using Octokit.Internal;
|
||||
@@ -10,6 +9,11 @@ namespace Octokit
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public class IssueUpdate
|
||||
{
|
||||
public IssueUpdate()
|
||||
{
|
||||
Labels = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Title of the milestone (required)
|
||||
/// </summary>
|
||||
@@ -45,8 +49,7 @@ namespace Octokit
|
||||
/// <remarks>
|
||||
/// Only users with push access can set labels for new issues. Labels are silently dropped otherwise.
|
||||
/// </remarks>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public ICollection<string> Labels { get; set; }
|
||||
public ICollection<string> Labels { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the issue is open or closed.
|
||||
@@ -63,12 +66,6 @@ namespace Octokit
|
||||
|
||||
public void AddLabel(string name)
|
||||
{
|
||||
// lazily create the label array
|
||||
if (Labels == null)
|
||||
{
|
||||
Labels = new List<string>();
|
||||
}
|
||||
|
||||
Labels.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,71 +13,71 @@ namespace Octokit
|
||||
/// <summary>
|
||||
/// The URL for this milestone.
|
||||
/// </summary>
|
||||
public Uri Url { get; set; }
|
||||
public Uri HtmlUrl { get; set; }
|
||||
public Uri Url { get; protected set; }
|
||||
|
||||
public Uri HtmlUrl { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The issue number.
|
||||
/// </summary>
|
||||
public int Number { get; set; }
|
||||
public int Number { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the issue is open or closed.
|
||||
/// </summary>
|
||||
public ItemState State { get; set; }
|
||||
public ItemState State { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Title of the issue
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
public string Title { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Details about the issue.
|
||||
/// </summary>
|
||||
public string Body { get; set; }
|
||||
public string Body { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user that created the issue.
|
||||
/// </summary>
|
||||
public User User { get; set; }
|
||||
public User User { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The set of labels applied to the issue
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public ICollection<Label> Labels { get; set; }
|
||||
public IReadOnlyCollection<Label> Labels { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user this issue is assigned to.
|
||||
/// </summary>
|
||||
public User Assignee { get; set; }
|
||||
public User Assignee { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The milestone, if any, that this issue is assigned to.
|
||||
/// </summary>
|
||||
public Milestone Milestone { get; set; }
|
||||
public Milestone Milestone { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of comments on the issue.
|
||||
/// </summary>
|
||||
public int Comments { get; set; }
|
||||
public int Comments { get; protected set; }
|
||||
|
||||
public PullRequest PullRequest { get; set; }
|
||||
public PullRequest PullRequest { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The date the issue was closed if closed.
|
||||
/// </summary>
|
||||
public DateTimeOffset? ClosedAt { get; set; }
|
||||
public DateTimeOffset? ClosedAt { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The date the issue was created.
|
||||
/// </summary>
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset CreatedAt { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The date the issue was last updated.
|
||||
/// </summary>
|
||||
public DateTimeOffset? UpdatedAt { get; set; }
|
||||
public DateTimeOffset? UpdatedAt { get; protected set; }
|
||||
|
||||
internal string DebuggerDisplay
|
||||
{
|
||||
@@ -95,7 +95,7 @@ namespace Octokit
|
||||
|
||||
var assignee = Assignee == null
|
||||
? null
|
||||
: Assignee.Name;
|
||||
: Assignee.Login;
|
||||
|
||||
var issueUpdate = new IssueUpdate
|
||||
{
|
||||
@@ -106,9 +106,9 @@ namespace Octokit
|
||||
Title = Title
|
||||
};
|
||||
|
||||
if (Labels.Any())
|
||||
foreach (var label in Labels.Select(l => l.Name))
|
||||
{
|
||||
issueUpdate.Labels = new List<string>(Labels.Select(l => l.Name));
|
||||
issueUpdate.Labels.Add(label);
|
||||
}
|
||||
|
||||
return issueUpdate;
|
||||
|
||||
Reference in New Issue
Block a user