diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 3bee5479..77b6773a 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -259,7 +259,11 @@ public class PullRequestsClientTests : IDisposable }); } - var newTree = new NewTree { Tree = collection }; + var newTree = new NewTree(); + foreach (var item in collection) + { + newTree.Tree.Add(item); + } return await _client.GitDatabase.Tree.Create(Helper.UserName, _repository.Name, newTree); } diff --git a/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs index 49374bba..35040390 100644 --- a/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoryCommitsClientTests.cs @@ -190,7 +190,11 @@ public class RepositoryCommitsClientTests }); } - var newTree = new NewTree { Tree = collection }; + var newTree = new NewTree(); + foreach (var item in collection) + { + newTree.Tree.Add(item); + } return await _client.GitDatabase.Tree.Create(Helper.UserName, _repository.Name, newTree); } diff --git a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs index 97db3c00..1a9147af 100644 --- a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs +++ b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs @@ -27,7 +27,11 @@ namespace Octokit.Tests.Integration.Helpers }); } - var newTree = new NewTree { Tree = collection }; + var newTree = new NewTree(); + foreach (var item in collection) + { + newTree.Tree.Add(item); + } return await client.GitDatabase.Tree.Create(repository.Owner.Login, repository.Name, newTree); } diff --git a/Octokit/Models/Request/NewTree.cs b/Octokit/Models/Request/NewTree.cs index 97b6e940..d88b177d 100644 --- a/Octokit/Models/Request/NewTree.cs +++ b/Octokit/Models/Request/NewTree.cs @@ -23,8 +23,7 @@ namespace Octokit /// /// The list of Tree Items for this new Tree item. /// - [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public ICollection Tree { get; set; } + public ICollection Tree { get; private set; } internal string DebuggerDisplay {