From b920bcdfcec241705505710666eaec5fafabde02 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Tue, 15 Mar 2016 17:17:33 +0700 Subject: [PATCH] A bunch of unit and integration tests for overloaded version of needed methods for IUserEmailsClient interface were added and impelemented. Base methods: Task> GetAll() Overload methods: Task> GetAll(ApiOptions options); --- .../Clients/UserEmailsClientTests.cs | 8 +++++++ .../Clients/UserEmailsClientTests.cs | 23 +++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs b/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs index f0af752c..9b54fb76 100644 --- a/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs @@ -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")] diff --git a/Octokit.Tests/Clients/UserEmailsClientTests.cs b/Octokit.Tests/Clients/UserEmailsClientTests.cs index b3564796..d2642c12 100644 --- a/Octokit.Tests/Clients/UserEmailsClientTests.cs +++ b/Octokit.Tests/Clients/UserEmailsClientTests.cs @@ -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(Arg.Is(u => u.ToString() == "user/emails")); + .GetAll(Arg.Is(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(); + var client = new UserEmailsClient(connection); + + client.GetAll(options); + + connection.Received(1) + .GetAll(Arg.Is(u => u.ToString() == "user/emails"), Arg.Is(apiOptions => apiOptions == options)); } }