Merge pull request #1139 from M-Zuber/fix#1136-IUserKeysClient.GetAll-GetAllForCurrent

IUserKeysClient.GetAll -> GetAllForCurrent()
This commit is contained in:
Ryan Gribble
2016-03-13 20:52:47 +10:00
8 changed files with 16 additions and 14 deletions
@@ -19,7 +19,8 @@ namespace Octokit.Reactive
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
IObservable<PublicKey> GetAll();
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable<PublicKey> GetAllForCurrent();
/// <summary>
/// Gets all verified public keys for a user.
@@ -29,9 +29,9 @@ namespace Octokit.Reactive
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
public IObservable<PublicKey> GetAll()
public IObservable<PublicKey> GetAllForCurrent()
{
return _client.GetAll().ToObservable().SelectMany(k => k);
return _client.GetAllForCurrent().ToObservable().SelectMany(k => k);
}
/// <summary>
@@ -14,7 +14,7 @@ namespace Octokit.Tests.Integration.Clients
using (var context = await github.CreatePublicKeyContext())
{
var keys = await github.User.Keys.GetAll();
var keys = await github.User.Keys.GetAllForCurrent();
Assert.NotEmpty(keys);
var first = keys[0];
@@ -72,7 +72,7 @@ namespace Octokit.Tests.Integration.Clients
await github.User.Keys.Delete(key.Id);
// Verify key no longer exists
var keys = await github.User.Keys.GetAll();
var keys = await github.User.Keys.GetAllForCurrent();
Assert.False(keys.Any(k => k.Title == keyTitle && k.Key == keyData));
}
}
@@ -21,7 +21,7 @@ namespace Octokit.Tests.Integration.Clients
{
using (var context = await _github.CreatePublicKeyContext())
{
var observable = _github.User.Keys.GetAll();
var observable = _github.User.Keys.GetAllForCurrent();
var keys = await (observable.ToList());
Assert.NotEmpty(keys);
@@ -80,7 +80,7 @@ namespace Octokit.Tests.Integration.Clients
await _github.User.Keys.Delete(key.Id);
// Verify key no longer exists
var keys = await (_github.User.Keys.GetAll().ToList());
var keys = await (_github.User.Keys.GetAllForCurrent().ToList());
Assert.False(keys.Any(k => k.Title == keyTitle && k.Key == keyData));
}
}
+2 -2
View File
@@ -8,7 +8,7 @@ namespace Octokit.Tests.Clients
{
public class UserKeysClientTests
{
public class TheGetAllMethod
public class TheGetAllForCurrentMethod
{
[Fact]
public void RequestsTheCorrectUrl()
@@ -17,7 +17,7 @@ namespace Octokit.Tests.Clients
var client = new UserKeysClient(connection);
var expectedUri = "user/keys";
client.GetAll();
client.GetAllForCurrent();
connection.Received().GetAll<PublicKey>(
Arg.Is<Uri>(u => u.ToString() == expectedUri));
@@ -8,7 +8,7 @@ namespace Octokit.Tests.Reactive
{
public class ObservableUserKeysClientTests
{
public class TheGetAllMethod
public class TheGetAllForCurrentMethod
{
[Fact]
public void CallsIntoClient()
@@ -16,9 +16,9 @@ namespace Octokit.Tests.Reactive
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableUserKeysClient(gitHubClient);
client.GetAll();
client.GetAllForCurrent();
gitHubClient.User.Keys.Received().GetAll();
gitHubClient.User.Keys.Received().GetAllForCurrent();
}
}
+2 -1
View File
@@ -19,7 +19,8 @@ namespace Octokit
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
Task<IReadOnlyList<PublicKey>> GetAll();
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
Task<IReadOnlyList<PublicKey>> GetAllForCurrent();
/// <summary>
/// Gets all verified public keys for a user.
+1 -1
View File
@@ -23,7 +23,7 @@ namespace Octokit
/// https://developer.github.com/v3/users/keys/#list-your-public-keys
/// </remarks>
/// <returns></returns>
public Task<IReadOnlyList<PublicKey>> GetAll()
public Task<IReadOnlyList<PublicKey>> GetAllForCurrent()
{
return ApiConnection.GetAll<PublicKey>(ApiUrls.Keys());
}