mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 03:01:31 +00:00
A bunch of unit and integration tests for overloaded version of needed methods for IUserEmailsClient interface were added and impelemented.
Base methods: Task<IReadOnlyList<EmailAddress>> GetAll() Overload methods: Task<IReadOnlyList<EmailAddress>> GetAll(ApiOptions options);
This commit is contained in:
@@ -15,6 +15,14 @@ namespace Octokit.Tests.Integration.Clients
|
||||
Assert.NotEmpty(emails);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanGetEmailWithApiOptions()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var emails = await github.User.Email.GetAll(ApiOptions.None);
|
||||
Assert.NotEmpty(emails);
|
||||
}
|
||||
|
||||
const string testEmailAddress = "hahaha-not-a-real-email@foo.com";
|
||||
|
||||
[IntegrationTest(Skip = "this isn't passing in CI - i hate past me right now")]
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Octokit.Tests.Clients
|
||||
{
|
||||
public class UserEmailsClientTests
|
||||
{
|
||||
public class TheGetAllMethod
|
||||
public class TheGetAllMethods
|
||||
{
|
||||
[Fact]
|
||||
public void GetsCorrectUrl()
|
||||
@@ -19,7 +19,26 @@ namespace Octokit.Tests.Clients
|
||||
client.GetAll();
|
||||
|
||||
connection.Received(1)
|
||||
.GetAll<EmailAddress>(Arg.Is<Uri>(u => u.ToString() == "user/emails"));
|
||||
.GetAll<EmailAddress>(Arg.Is<Uri>(u => u.ToString() == "user/emails"),
|
||||
Arg.Is(ApiOptions.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetsCorrectUrlWithApiOptions()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
StartPage = 1,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new UserEmailsClient(connection);
|
||||
|
||||
client.GetAll(options);
|
||||
|
||||
connection.Received(1)
|
||||
.GetAll<EmailAddress>(Arg.Is<Uri>(u => u.ToString() == "user/emails"), Arg.Is<ApiOptions>(apiOptions => apiOptions == options));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user