Skip to content

Commit

Permalink
Formatted Code
Browse files Browse the repository at this point in the history
  • Loading branch information
prayankmathur committed Mar 25, 2016
1 parent 6f5d31e commit f439c77
Show file tree
Hide file tree
Showing 30 changed files with 133 additions and 131 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public interface IObservableEnterpriseLdapClient
/// <param name="userName">The username to sync LDAP mapping</param>
/// <returns>The <see cref="LdapSyncResponse"/> of the queue request.</returns>
IObservable<LdapSyncResponse> QueueSyncUserMapping(string userName);

/// <summary>
/// Update the LDAP mapping for a team on a GitHub Enterprise appliance (must be Site Admin user).
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public IObservable<LdapSyncResponse> QueueSyncUserMapping(string userName)
{
return _client.QueueSyncUserMapping(userName).ToObservable();
}

/// <summary>
/// Update the LDAP mapping for a team on a GitHub Enterprise appliance (must be Site Admin user).
/// </summary>
Expand Down
40 changes: 20 additions & 20 deletions Octokit.Reactive/Clients/IObservableIssuesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,25 @@ public interface IObservableIssuesClient
/// </param>
/// <returns></returns>
IObservable<Issue> Update(string owner, string name, int number, IssueUpdate issueUpdate);
/// <summary>
/// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#lock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
IObservable<Unit> LockIssue(string owner, string name, int number);
/// <summary>
/// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#unlock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
IObservable<Unit> UnlockIssue(string owner, string name, int number);

/// <summary>
/// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#lock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
IObservable<Unit> LockIssue(string owner, string name, int number);

/// <summary>
/// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#unlock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
IObservable<Unit> UnlockIssue(string owner, string name, int number);
}
}
64 changes: 32 additions & 32 deletions Octokit.Reactive/Clients/ObservableIssuesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,37 +223,37 @@ public IObservable<Issue> Update(string owner, string name, int number, IssueUpd

return _client.Update(owner, name, number, issueUpdate).ToObservable();
}
/// <summary>
/// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#lock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public IObservable<Unit> LockIssue(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.LockIssue(owner, name, number).ToObservable();
}
/// <summary>
/// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#unlock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public IObservable<Unit> UnlockIssue(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return _client.UnlockIssue(owner, name, number).ToObservable();
}

/// <summary>
/// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#lock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public IObservable<Unit> LockIssue(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");

return _client.LockIssue(owner, name, number).ToObservable();
}

/// <summary>
/// Unlocks an issue for the specified repository. Issue owners and users with push access can unlock an issue.
/// </summary>
/// <remarks>https://developer.github.com/v3/issues/#unlock-an-issue</remarks>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="number">The issue number</param>
/// <returns></returns>
public IObservable<Unit> UnlockIssue(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");

return _client.UnlockIssue(owner, name, number).ToObservable();
}
}
}
2 changes: 1 addition & 1 deletion Octokit.Reactive/Helpers/ConnectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static IObservable<T> GetPagesWithOptions<T>(Uri uri, ApiOptions options,
nextPageUri,
options);

return shouldContinue
return shouldContinue
? Observable.Defer(() => getPageFunc(nextPageUri, null))
: Observable.Empty<IApiResponse<List<T>>>();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace Octokit.Tests.Conventions
public class ApiOptionsMissingException : Exception
{
public ApiOptionsMissingException(Type type, IEnumerable<MethodInfo> methods)
: base(CreateMessage(type, methods)) { }
: base(CreateMessage(type, methods))
{ }

static string CreateMessage(Type type, IEnumerable<MethodInfo> methods)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class EnterpriseLdapClientTests : IDisposable
public EnterpriseLdapClientTests()
{
_github = EnterpriseHelper.GetAuthenticatedClient();

NewTeam newTeam = new NewTeam(Helper.MakeNameWithTimestamp("test-team")) { Description = "Test Team" };
_context = _github.CreateEnterpriseTeamContext(EnterpriseHelper.Organization, newTeam).Result;
}
Expand Down
36 changes: 18 additions & 18 deletions Octokit.Tests.Integration/Clients/IssuesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,24 @@ public async Task CanCreateRetrieveAndCloseIssue()
[IntegrationTest]
public async Task CanLockAndUnlockIssue()
{
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Equal(false, issue.Locked);
await _issuesClient.LockIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.Equal(true, issue.Locked);
await _issuesClient.UnlockIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.Equal(false, issue.Locked);
}
[IntegrationTest]
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

Assert.Equal(false, issue.Locked);

await _issuesClient.LockIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.Equal(true, issue.Locked);

await _issuesClient.UnlockIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved);
Assert.Equal(false, issue.Locked);
}

[IntegrationTest]
public async Task CanListOpenIssuesWithDefaultSort()
{
var newIssue1 = new NewIssue("A test issue1") { Body = "A new unassigned issue" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ public async Task DeletesRepository()
var repoName = Helper.MakeNameWithTimestamp("repo-to-delete");

await github.Repository.Create(new NewRepository(repoName));

await github.Repository.Delete(Helper.UserName, repoName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public async Task CanAddAndDeleteImpersonationToken()

Assert.NotNull(token);
Assert.True(
token.Scopes.Count() == 1 &&
token.Scopes.Count() == 1 &&
token.Scopes.All(s => s == "public_repo"));

// Delete Impersonation token
Expand Down Expand Up @@ -187,7 +187,7 @@ public async Task CanDeletePublicKey()
{
// Ensure user has a key
//var key = await _github.User.Keys.Create(new NewPublicKey("title", "key"));

// Delete key
//await _github.User.Administration.DeletePublicKey(key.Id);
}
Expand Down
2 changes: 1 addition & 1 deletion Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public async Task ReturnsCorrectCountOfEmailsWithoutStart()

Assert.NotEmpty(emails);
}

const string testEmailAddress = "[email protected]";

[IntegrationTest(Skip = "this isn't passing in CI - i hate past me right now")]
Expand Down
8 changes: 4 additions & 4 deletions Octokit.Tests.Integration/EnterpriseHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static class EnterpriseHelper
string enabled = Environment.GetEnvironmentVariable("OCTOKIT_GHE_ENABLED");
return !String.IsNullOrWhiteSpace(enabled);
});

static readonly Lazy<Uri> _gitHubEnterpriseUrl = new Lazy<Uri>(() =>
{
string uri = Environment.GetEnvironmentVariable("OCTOKIT_GHE_URL");
Expand All @@ -76,7 +76,7 @@ static EnterpriseHelper()

public static string UserName { get; private set; }
public static string Organization { get; private set; }

/// <summary>
/// These credentials should be set to a test GitHub account using the powershell script configure-integration-tests.ps1
/// </summary>
Expand All @@ -88,8 +88,8 @@ static EnterpriseHelper()

public static bool IsGitHubEnterpriseEnabled { get { return _gitHubEnterpriseEnabled.Value; } }

public static Uri GitHubEnterpriseUrl { get { return _gitHubEnterpriseUrl.Value; } }
public static Uri GitHubEnterpriseUrl { get { return _gitHubEnterpriseUrl.Value; } }

public static bool IsUsingToken
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public class ObservableEnterpriseLdapClientTests : IDisposable

readonly string _testUser = "test-user";
readonly string _distinguishedNameUser = "uid=test-user,ou=users,dc=company,dc=com";

readonly EnterpriseTeamContext _context;
readonly string _distinguishedNameTeam = "cn=test-team,ou=groups,dc=company,dc=com";

public ObservableEnterpriseLdapClientTests()
{
_github = new ObservableGitHubClient(EnterpriseHelper.GetAuthenticatedClient());
Expand Down
32 changes: 16 additions & 16 deletions Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,23 @@ public async Task CanCreateAndUpdateIssues()
Assert.Equal("Modified integration test issue", updateResult.Title);
}

[IntegrationTest]
public async Task CanLockAndUnlockIssues()
{
var newIssue = new NewIssue("Integration Test Issue");
var createResult = await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
Assert.Equal(false, createResult.Locked);
await _client.LockIssue(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
var lockResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
Assert.Equal(true, lockResult.Locked);
await _client.UnlockIssue(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
var unlockIssueResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
Assert.Equal(false, unlockIssueResult.Locked);
[IntegrationTest]
public async Task CanLockAndUnlockIssues()
{
var newIssue = new NewIssue("Integration Test Issue");

var createResult = await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
Assert.Equal(false, createResult.Locked);

await _client.LockIssue(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
var lockResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
Assert.Equal(true, lockResult.Locked);

await _client.UnlockIssue(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
var unlockIssueResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
Assert.Equal(false, unlockIssueResult.Locked);
}

public void Dispose()
{
_context.Dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public async Task CanCreateAndDeleteKey()
// Create a key
string keyTitle = "title";
string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ==";

var observable = _github.User.Keys.Create(new NewPublicKey(keyTitle, keyData));
var key = await observable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void RequestsCorrectUrl()

string expectedUri = "admin/organizations";
client.Create(new NewOrganization("org", "admin", "org name"));

connection.Received().Post<Organization>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
}

Expand Down
1 change: 0 additions & 1 deletion Octokit.Tests/Clients/RepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ public void CanFilterByAffiliation()

var request = new RepositoryRequest
{

Affiliation = RepositoryAffiliation.Owner,
Sort = RepositorySort.FullName
};
Expand Down
2 changes: 1 addition & 1 deletion Octokit.Tests/Clients/RepositoryContentsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void RequestsCorrectUrl()

string expectedUri = "repos/org/repo/contents/path/to/file";
client.CreateFile("org", "repo", "path/to/file", new CreateFileRequest("message", "myfilecontents", "mybranch"));

connection.Received().Put<RepositoryContentChangeSet>(Arg.Is<Uri>(u => u.ToString() == expectedUri), Arg.Any<object>());
}

Expand Down
8 changes: 4 additions & 4 deletions Octokit.Tests/Clients/UserAdministrationClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void RequestsTheCorrectUrl()
client.Create(new NewUser("name", "[email protected]"));

connection.Received().Post<User>(
Arg.Is<Uri>(u => u.ToString() == expectedUri),
Arg.Is<Uri>(u => u.ToString() == expectedUri),
Arg.Any<object>());
}

Expand All @@ -38,13 +38,13 @@ public void PassesRequestObject()
{
var connection = Substitute.For<IApiConnection>();
var client = new UserAdministrationClient(connection);

client.Create(new NewUser("name", "[email protected]"));

connection.Received().Post<User>(
Arg.Any<Uri>(),
Arg.Any<Uri>(),
Arg.Is<NewUser>(a =>
a.Login == "name" &&
a.Login == "name" &&
a.Email == "[email protected]"));
}
}
Expand Down
Loading

0 comments on commit f439c77

Please sign in to comment.