Corrected TheUpdateMethod.EnsureArgumentsNotNull()

This commit is contained in:
Prayank Mathur
2016-03-17 11:55:44 +05:30
parent f354d1bf00
commit db8738b675
23 changed files with 47 additions and 46 deletions

View File

@@ -33,7 +33,7 @@ namespace Octokit.Reactive
/// <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>

View File

@@ -49,7 +49,7 @@ namespace Octokit.Reactive
{
return _client.QueueSyncUserMapping(userName).ToObservable();
}
/// <summary>
/// Update the LDAP mapping for a team on a GitHub Enterprise appliance (must be Site Admin user).
/// </summary>

View File

@@ -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;
}

View File

@@ -447,7 +447,7 @@ public class RepositoriesClientTests
var repoName = Helper.MakeNameWithTimestamp("repo-to-delete");
await github.Repository.Create(new NewRepository(repoName));
await github.Repository.Delete(Helper.UserName, repoName);
}
}

View File

@@ -95,7 +95,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.NotNull(token);
Assert.True(
token.Scopes.Count() == 1 &&
token.Scopes.Count() == 1 &&
token.Scopes.All(s => s == "public_repo"));
// Delete Impersonation token
@@ -187,7 +187,7 @@ namespace Octokit.Tests.Integration.Clients
{
// 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);
}

View File

@@ -55,7 +55,7 @@ namespace Octokit.Tests.Integration
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");
@@ -76,7 +76,7 @@ namespace Octokit.Tests.Integration
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>
@@ -88,8 +88,8 @@ namespace Octokit.Tests.Integration
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

View File

@@ -14,10 +14,10 @@ namespace Octokit.Tests.Integration
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());

View File

@@ -68,7 +68,7 @@ namespace Octokit.Tests.Integration.Clients
// 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;

View File

@@ -17,7 +17,7 @@ namespace Octokit.Tests.Clients
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>());
}

View File

@@ -404,7 +404,6 @@ namespace Octokit.Tests.Clients
var request = new RepositoryRequest
{
Affiliation = RepositoryAffiliation.Owner,
Sort = RepositorySort.FullName
};

View File

@@ -100,7 +100,7 @@ namespace Octokit.Tests.Clients
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>());
}

View File

@@ -29,7 +29,7 @@ namespace Octokit.Tests.Clients
client.Create(new NewUser("name", "email@company.com"));
connection.Received().Post<User>(
Arg.Is<Uri>(u => u.ToString() == expectedUri),
Arg.Is<Uri>(u => u.ToString() == expectedUri),
Arg.Any<object>());
}
@@ -38,13 +38,13 @@ namespace Octokit.Tests.Clients
{
var connection = Substitute.For<IApiConnection>();
var client = new UserAdministrationClient(connection);
client.Create(new NewUser("name", "email@company.com"));
connection.Received().Post<User>(
Arg.Any<Uri>(),
Arg.Any<Uri>(),
Arg.Is<NewUser>(a =>
a.Login == "name" &&
a.Login == "name" &&
a.Email == "email@company.com"));
}
}

View File

@@ -10,7 +10,7 @@ namespace Octokit.Tests
public class TheUpdateUserMappingMethod
{
readonly string _distinguishedName = "uid=test-user,ou=users,dc=company,dc=com";
[Fact]
public void CallsIntoClient()
{
@@ -20,11 +20,11 @@ namespace Octokit.Tests
client.UpdateUserMapping("test-user", new NewLdapMapping(_distinguishedName));
github.Enterprise.Ldap.Received(1).UpdateUserMapping(
Arg.Is<string>(a => a == "test-user"),
Arg.Is<NewLdapMapping>(a =>
Arg.Is<NewLdapMapping>(a =>
a.LdapDistinguishedName == _distinguishedName));
}
}
public class TheQueueSyncUserMappingMethod
{
[Fact]
@@ -38,11 +38,11 @@ namespace Octokit.Tests
Arg.Is<string>(a => a == "test-user"));
}
}
public class TheUpdateTeamMappingMethod
{
readonly string _distinguishedName = "cn=test-team,ou=groups,dc=company,dc=com";
[Fact]
public void CallsIntoClient()
{
@@ -52,11 +52,11 @@ namespace Octokit.Tests
client.UpdateTeamMapping(1, new NewLdapMapping(_distinguishedName));
github.Enterprise.Ldap.Received(1).UpdateTeamMapping(
Arg.Is<int>(a => a == 1),
Arg.Is<NewLdapMapping>(a =>
Arg.Is<NewLdapMapping>(a =>
a.LdapDistinguishedName == _distinguishedName));
}
}
public class TheQueueSyncTeamMappingMethod
{
[Fact]

View File

@@ -17,9 +17,9 @@ namespace Octokit.Tests
client.Create(new NewOrganization("org", "admin", "org name"));
github.Enterprise.Organization.Received(1).Create(
Arg.Is<NewOrganization>(a =>
a.Login == "org"
&& a.Admin == "admin"
Arg.Is<NewOrganization>(a =>
a.Login == "org"
&& a.Admin == "admin"
&& a.ProfileName == "org name"));
}
}

View File

@@ -17,7 +17,7 @@ namespace Octokit.Tests
client.Queue("org");
github.Enterprise.SearchIndexing.Received(1).
Queue(Arg.Is<string>( "org" ));
Queue(Arg.Is<string>("org"));
client.Queue("org", "repo");
github.Enterprise.SearchIndexing.Received(1).

View File

@@ -329,11 +329,11 @@ public class ObservableIssuesClientTests
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableIssuesClient(gitHubClient);
Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", new NewIssue("title")));
Assert.Throws<ArgumentException>(() => client.Create("", "name", new NewIssue("x")));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, new NewIssue("x")));
Assert.Throws<ArgumentException>(() => client.Create("owner", "", new NewIssue("x")));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", "name", null));
Assert.Throws<ArgumentNullException>(() => client.Update(null, "name", 42, new IssueUpdate()));
Assert.Throws<ArgumentException>(() => client.Update("", "name", 42, new IssueUpdate()));
Assert.Throws<ArgumentNullException>(() => client.Update("owner", null, 42, new IssueUpdate()));
Assert.Throws<ArgumentException>(() => client.Update("owner", "", 42, new IssueUpdate()));
Assert.Throws<ArgumentNullException>(() => client.Update("owner", "name", 42, null));
}
}

View File

@@ -19,7 +19,7 @@ namespace Octokit.Tests.Reactive
client.Create(new NewUser("auser", "email@company.com"));
gitHubClient.User.Administration.Received().Create(
Arg.Is<NewUser>(a =>
Arg.Is<NewUser>(a =>
a.Login == "auser" &&
a.Email == "email@company.com"));
}

View File

@@ -45,7 +45,7 @@ namespace Octokit
public async Task<LdapSyncResponse> QueueSyncUserMapping(string userName)
{
Ensure.ArgumentNotNull(userName, "userName");
var endpoint = ApiUrls.EnterpriseLdapUserSync(userName);
var response = await Connection.Post<LdapSyncResponse>(endpoint);
@@ -56,7 +56,7 @@ namespace Octokit
return response.Body;
}
/// <summary>
/// Update the LDAP mapping for a team on a GitHub Enterprise appliance (must be Site Admin user).
/// </summary>
@@ -87,7 +87,7 @@ namespace Octokit
public async Task<LdapSyncResponse> QueueSyncTeamMapping(int teamId)
{
Ensure.ArgumentNotNull(teamId, "teamId");
var endpoint = ApiUrls.EnterpriseLdapTeamSync(teamId);
var response = await Connection.Post<LdapSyncResponse>(endpoint);

View File

@@ -146,7 +146,7 @@ namespace Octokit
public async Task<SearchIndexingResponse> QueueAllCode(string owner)
{
Ensure.ArgumentNotNull(owner, "owner");
var endpoint = ApiUrls.EnterpriseSearchIndexing();
var target = new SearchIndexTarget(string.Format(CultureInfo.InvariantCulture, "{0}/*/code", owner));

View File

@@ -218,7 +218,7 @@ namespace Octokit
{
Ensure.ArgumentNotNull(keyId, "keyId");
var endpoint = ApiUrls.UserAdministrationPublicKeys(keyId);
var response = ((HttpStatusCode)await Connection.Delete(endpoint));
if (response != HttpStatusCode.NoContent)
{

View File

@@ -141,7 +141,7 @@ namespace Octokit
/// <returns>The created API resource.</returns>
/// <exception cref="ApiException">Thrown when an API error occurs.</exception>
Task<T> Post<T>(Uri uri);
/// <summary>
/// Creates a new API resource in the list at the specified URI.
/// </summary>

View File

@@ -26,7 +26,7 @@ namespace Octokit
/// </summary>
/// <param name="message">The message.</param>
/// <param name="branch">The branch the request is for.</param>
protected ContentRequest(string message, string branch): this(message)
protected ContentRequest(string message, string branch) : this(message)
{
Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

View File

@@ -6,8 +6,10 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersionAttribute("0.19.0")]
[assembly: AssemblyFileVersionAttribute("0.19.0")]
[assembly: ComVisibleAttribute(false)]
namespace System {
internal static class AssemblyVersionInformation {
namespace System
{
internal static class AssemblyVersionInformation
{
internal const string Version = "0.19.0";
}
}