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:
aedampir@gmail.com
2016-03-15 17:17:33 +07:00
parent ec5de110ad
commit b920bcdfce
2 changed files with 29 additions and 2 deletions
@@ -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")]
+21 -2
View File
@@ -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));
}
}