forked from octokit/octokit.net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request octokit#1132 from AlexP11223/fix-type-and-visibili…
…ty-affilation-mix-1107 octokit#1107 Do no set default visibility and affiliation values to avoid mixing with type
- Loading branch information
Showing
4 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Xunit; | ||
|
||
namespace Octokit.Tests.Models | ||
{ | ||
public class RepositoryRequestTests | ||
{ | ||
public class TheToParametersDictionaryMethod | ||
{ | ||
[Fact] | ||
public void ContainsSetValues() | ||
{ | ||
var request = new RepositoryRequest | ||
{ | ||
Type = RepositoryType.All, | ||
Sort = RepositorySort.FullName, | ||
Direction = SortDirection.Ascending | ||
}; | ||
|
||
var parameters = request.ToParametersDictionary(); | ||
|
||
Assert.Equal(3, parameters.Count); | ||
Assert.Equal("all", parameters["type"]); | ||
Assert.Equal("full_name", parameters["sort"]); | ||
Assert.Equal("asc", parameters["direction"]); | ||
|
||
request = new RepositoryRequest | ||
{ | ||
Affiliation = RepositoryAffiliation.All, | ||
Visibility = RepositoryVisibility.Public | ||
}; | ||
|
||
parameters = request.ToParametersDictionary(); | ||
|
||
Assert.Equal(2, parameters.Count); | ||
Assert.Equal("owner, collaborator, organization_member", parameters["affiliation"]); | ||
Assert.Equal("public", parameters["visibility"]); | ||
} | ||
|
||
[Fact] | ||
public void DoesNotReturnValuesForDefaultRequest() | ||
{ | ||
var request = new RepositoryRequest(); | ||
|
||
var parameters = request.ToParametersDictionary(); | ||
|
||
Assert.Empty(parameters); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters