From 8d3aa5b41e32c6596fe14dc9fe4673984d964d27 Mon Sep 17 00:00:00 2001 From: "Jason K." Date: Thu, 27 Feb 2014 16:50:54 -0500 Subject: [PATCH] - Added Get method to the Octokit/Clients/ITeamsClient interface. - Implemented the aforementioned Get method in the Octokit/Clients/TeamsClient class. - Added test in Octokit.Tests/Clients/TeamsClientTests for the aforementioned Get method. --- Octokit.Tests/Clients/TeamsClientTests.cs | 14 ++++++++++++++ Octokit/Clients/ITeamsClient.cs | 13 +++++++++++++ Octokit/Clients/TeamsClient.cs | 15 +++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/Octokit.Tests/Clients/TeamsClientTests.cs b/Octokit.Tests/Clients/TeamsClientTests.cs index e3c09858..3251e7d0 100644 --- a/Octokit.Tests/Clients/TeamsClientTests.cs +++ b/Octokit.Tests/Clients/TeamsClientTests.cs @@ -21,6 +21,20 @@ namespace Octokit.Tests.Clients } } + public class TheGetMethod + { + [Fact] + public void RequestsTheCorrectlUrl() + { + var connection = Substitute.For(); + var client = new TeamsClient(connection); + + client.Get(1); + + connection.Received().Get(Arg.Is(u => u.ToString() == "teams/1"), null); + } + } + public class TheGetAllMethod { [Fact] diff --git a/Octokit/Clients/ITeamsClient.cs b/Octokit/Clients/ITeamsClient.cs index a2abafab..c00b5735 100644 --- a/Octokit/Clients/ITeamsClient.cs +++ b/Octokit/Clients/ITeamsClient.cs @@ -14,6 +14,19 @@ namespace Octokit /// public interface ITeamsClient { + /// + /// Gets a . + /// + /// + /// http://developer.github.com/v3/orgs/teams/#get-team + /// + /// The id of the . + /// Thrown when a general API error occurs. + /// A . + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", + Justification = "Method makes a network request")] + Task Get(int id); + /// /// Returns all s for the current org. /// diff --git a/Octokit/Clients/TeamsClient.cs b/Octokit/Clients/TeamsClient.cs index 9928e62e..8d02e3df 100644 --- a/Octokit/Clients/TeamsClient.cs +++ b/Octokit/Clients/TeamsClient.cs @@ -24,6 +24,21 @@ namespace Octokit { } + /// + /// Gets a . + /// + /// + /// http://developer.github.com/v3/orgs/teams/#get-team + /// + /// The id of the . + /// Thrown when a general API error occurs. + /// A . + public Task Get(int id) + { + var endpoint = ApiUrls.Team(id); + return ApiConnection.Get(endpoint); + } + /// /// Returns all s for the current org. ///