Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PreviousFileName to the PullRequestFile model #1770

Merged
merged 2 commits into from
Feb 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,10 @@ public async Task CanBrowseFiles()
{
var expectedFiles = new List<PullRequestFile>
{
new PullRequestFile(null, "Octokit.Tests.Integration/Clients/ReferencesClientTests.cs", null, 8, 3, 11, null, null, null, null),
new PullRequestFile(null, "Octokit/Clients/ApiPagination.cs", null, 21, 6, 27, null, null, null, null),
new PullRequestFile(null, "Octokit/Helpers/IApiPagination.cs", null, 1, 1, 2, null, null, null, null),
new PullRequestFile(null, "Octokit/Http/ApiConnection.cs", null, 1, 1, 2, null, null, null, null)
new PullRequestFile(null, "Octokit.Tests.Integration/Clients/ReferencesClientTests.cs", null, 8, 3, 11, null, null, null, null, null),
new PullRequestFile(null, "Octokit/Clients/ApiPagination.cs", null, 21, 6, 27, null, null, null, null, null),
new PullRequestFile(null, "Octokit/Helpers/IApiPagination.cs", null, 1, 1, 2, null, null, null, null, null),
new PullRequestFile(null, "Octokit/Http/ApiConnection.cs", null, 1, 1, 2, null, null, null, null, null)
};

var result = await _fixture.Files("octokit", "octokit.net", 288);
Expand All @@ -894,10 +894,10 @@ public async Task CanBrowseFilesWithRepositoryId()
{
var expectedFiles = new List<PullRequestFile>
{
new PullRequestFile(null, "Octokit.Tests.Integration/Clients/ReferencesClientTests.cs", null, 8, 3, 11, null, null, null, null),
new PullRequestFile(null, "Octokit/Clients/ApiPagination.cs", null, 21, 6, 27, null, null, null, null),
new PullRequestFile(null, "Octokit/Helpers/IApiPagination.cs", null, 1, 1, 2, null, null, null, null),
new PullRequestFile(null, "Octokit/Http/ApiConnection.cs", null, 1, 1, 2, null, null, null, null)
new PullRequestFile(null, "Octokit.Tests.Integration/Clients/ReferencesClientTests.cs", null, 8, 3, 11, null, null, null, null, null),
new PullRequestFile(null, "Octokit/Clients/ApiPagination.cs", null, 21, 6, 27, null, null, null, null, null),
new PullRequestFile(null, "Octokit/Helpers/IApiPagination.cs", null, 1, 1, 2, null, null, null, null, null),
new PullRequestFile(null, "Octokit/Http/ApiConnection.cs", null, 1, 1, 2, null, null, null, null, null)
};

var result = await _fixture.Files(7528679, 288);
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Reactive/ObservablePullRequestsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ public class TheFilesMethod
[Fact]
public async Task FetchesAllFilesForPullRequest()
{
var file = new PullRequestFile(null, null, null, 0, 0, 0, null, null, null, null);
var file = new PullRequestFile(null, null, null, 0, 0, 0, null, null, null, null, null);
var expectedUrl = "repos/fake/repo/pulls/42/files";
var gitHubClient = Substitute.For<IGitHubClient>();
var connection = Substitute.For<IConnection>();
Expand All @@ -717,7 +717,7 @@ public async Task FetchesAllFilesForPullRequest()
[Fact]
public async Task FetchesAllFilesForPullRequestWithRepositoryId()
{
var file = new PullRequestFile(null, null, null, 0, 0, 0, null, null, null, null);
var file = new PullRequestFile(null, null, null, 0, 0, 0, null, null, null, null, null);
var expectedUrl = "repositories/1/pulls/42/files";
var gitHubClient = Substitute.For<IGitHubClient>();
var connection = Substitute.For<IConnection>();
Expand Down
5 changes: 4 additions & 1 deletion Octokit/Models/Response/PullRequestFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class PullRequestFile
{
public PullRequestFile() { }

public PullRequestFile(string sha, string fileName, string status, int additions, int deletions, int changes, string blobUrl, string rawUrl, string contentsUrl, string patch)
public PullRequestFile(string sha, string fileName, string status, int additions, int deletions, int changes, string blobUrl, string rawUrl, string contentsUrl, string patch, string previousFileName)
{
Sha = sha;
FileName = fileName;
Expand All @@ -21,6 +21,7 @@ public PullRequestFile(string sha, string fileName, string status, int additions
RawUrl = rawUrl;
ContentsUrl = contentsUrl;
Patch = patch;
PreviousFileName = previousFileName;
}

public string Sha { get; protected set; }
Expand All @@ -34,6 +35,8 @@ public PullRequestFile(string sha, string fileName, string status, int additions
public string RawUrl { get; protected set; }
public string ContentsUrl { get; protected set; }
public string Patch { get; protected set; }
[Parameter(Key = "previous_filename")]
public string PreviousFileName { get; protected set; }

internal string DebuggerDisplay
{
Expand Down