Skip to content

Commit

Permalink
added unit tests for the new-parameters-on-ListYourRepository
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarmad93 committed Feb 9, 2016
1 parent d7cb562 commit 2366c99
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
41 changes: 41 additions & 0 deletions Octokit.Tests/Clients/RepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,47 @@ public void CanFilterBySortDirection()
Arg.Is<Dictionary<string, string>>(d =>
d["type"] == "member" && d["sort"] == "updated" && d["direction"] == "asc"));
}

[Fact]
public void CanFilterByVisibility()
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);

var request = new RepositoryRequest
{
Visibility = RepositoryVisibility.Private
};
client.GetAllForCurrent(request);

connection.Received()
.GetAll<Repository>(
Arg.Is<Uri>(u => u.ToString() == "user/repos"),
Arg.Is<Dictionary<string, string>>(d =>
d["visibility"] == "private"));
}

[Fact]
public void CanFilterByAffiliation()
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);

var request = new RepositoryRequest
{

Affiliation = RepositoryAffiliation.Owner,
Sort = RepositorySort.FullName
};

client.GetAllForCurrent(request);

connection.Received()
.GetAll<Repository>(
Arg.Is<Uri>(u => u.ToString() == "user/repos"),
Arg.Is<Dictionary<string, string>>(d =>
d["affiliation"] == "owner" && d["sort"] == "full_name"));
}
}

public class TheGetAllForUserMethod
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Helpers/UriExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Octokit
public static class UriExtensions
{
/// <summary>
/// Merge a dictionary of valeus with an existing <see cref="Uri"/>
/// Merge a dictionary of values with an existing <see cref="Uri"/>
/// </summary>
/// <param name="uri">Original request Uri</param>
/// <param name="parameters">Collection of key-value pairs</param>
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Models/Request/RepositoryRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public enum RepositorySort
}

/// <summary>
/// The properties that repositories can be visibled by.
/// The properties that repositories can be visible by.
/// </summary>
public enum RepositoryVisibility
{
Expand Down

0 comments on commit 2366c99

Please sign in to comment.