Skip to content

Commit

Permalink
Add PreviousFileName to the PullRequestFile model (#1770)
Browse files Browse the repository at this point in the history
* Add PreviousFileName to the PullRequestFile model

* fix white space issue
  • Loading branch information
Kaneraz authored and ryangribble committed Feb 23, 2018
1 parent c4774ff commit e430a9e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
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

0 comments on commit e430a9e

Please sign in to comment.