public async Task EnsuresNonNullArguments() { var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, null)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo")); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll("user", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, null, null)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, null, ApiOptions.None)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll("user", null, null)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo", ApiOptions.None)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll("user", null, ApiOptions.None)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.GetAll("user", "repo", null)); await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.GetAll("user", "")); await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.GetAll("", "repo")); }
public async Task EnsuresNonNullArguments() { var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For <IApiConnection>()); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.Create(null, "repo", new NewDeployKey())); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.Create("user", null, new NewDeployKey())); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.Create("user", "repo", null)); await Assert.ThrowsAsync <ArgumentNullException>(() => deployKeysClient.Create(1, null)); await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.Create("", "repo", new NewDeployKey())); await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.Create("user", "", new NewDeployKey())); await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.Create("user", "repo", new NewDeployKey())); await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.Create("user", "repo", new NewDeployKey { Key = "ABC123" })); await Assert.ThrowsAsync <ArgumentException>(() => deployKeysClient.Create("user", "repo", new NewDeployKey { Title = "user@repo" })); }
public async Task RequestsCorrectUrlWithRepositoryId() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); await deployKeysClient.GetAll(1); apiConnection.Received().GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/keys"), Args.ApiOptions); }
public void GetsAListOfDeployKeys() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.GetAll("user", "repo"); apiConnection.Received().GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys")); }
public void EnsuresNonNullArguments() { var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For <IApiConnection>()); Assert.Throws <ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo")); Assert.Throws <ArgumentException>(() => deployKeysClient.GetAll("", "repo")); Assert.Throws <ArgumentNullException>(() => deployKeysClient.GetAll("user", null)); Assert.Throws <ArgumentException>(() => deployKeysClient.GetAll("user", "")); }
public void DeletesCorrectUrl() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.Delete("user", "repo", 42); apiConnection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys/42")); }
public void EnsureNonNullArguments() { var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For<IApiConnection>()); Assert.Throws<ArgumentNullException>(() => deployKeysClient.Get(null, "repo", 1)); Assert.Throws<ArgumentException>(() => deployKeysClient.Get("", "repo", 1)); Assert.Throws<ArgumentNullException>(() => deployKeysClient.Get("user", null, 1)); Assert.Throws<ArgumentException>(() => deployKeysClient.Get("user", "", 1)); }
public void GetsAListOfDeployKeys() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.GetAll("user", "repo"); apiConnection.Received().GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys")); }
public async Task RequestsCorrectUrlWithRepositoryId() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); await deployKeysClient.GetAll(1); apiConnection.Received().GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/keys"), Args.ApiOptions); }
public async Task RequestsCorrectUrl() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); await deployKeysClient.Get("user", "repo", 42); apiConnection.Received().Get <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys/42")); }
public async Task DeletesCorrectUrlWithRepositoryId() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); await deployKeysClient.Delete(1, 42); apiConnection.Received().Delete(Arg.Is <Uri>(u => u.ToString() == "repositories/1/keys/42")); }
public async Task RequestsCorrectUrl() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); await deployKeysClient.Get("user", "repo", 42); apiConnection.Received().Get<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys/42")); }
public async Task EnsuresNonNullArguments() { var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll(null, "repo")); await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.GetAll("", "repo")); await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.GetAll("user", null)); await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.GetAll("user", "")); }
public void SendsCreateToCorrectUrl() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.Create("user", "repo", new NewDeployKey { Key = "ABC123", Title = "user@repo" }); apiConnection.Received().Post<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys"), Args.NewDeployKey); }
public void GetsADeployKey() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.Get("user", "repo", 42); apiConnection.Received().Get <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys/42"), null); }
public void GetsADeployKey() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.Get("user", "repo", 42); apiConnection.Received().Get<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys/42"), null); }
public void SendsCreateToCorrectUrl() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.Create("user", "repo", new NewDeployKey { Key = "ABC123", Title = "user@repo" }); apiConnection.Received().Post <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys"), Args.NewDeployKey); }
public void CreatesCorrectUrlWithRepositoryId() { var apiConnection = Substitute.For <IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); var newDeployKey = new NewDeployKey { Key = "ABC123", Title = "user@repo" }; deployKeysClient.Create(1, newDeployKey); apiConnection.Received().Post <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/keys"), newDeployKey); }
public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryDeployKeysClient(connection); var options = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; await client.GetAll(1, options); connection.Received(1) .GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/keys"), options); }
public void GetsAListOfDeployKeysWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryDeployKeysClient(connection); var options = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; client.GetAll("user", "repo", options); connection.Received(1) .GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys"), options); }
public void GetsAListOfDeployKeysWithApiOptions() { var connection = Substitute.For <IApiConnection>(); var client = new RepositoryDeployKeysClient(connection); var options = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; client.GetAll("user", "repo", options); connection.Received(1) .GetAll <DeployKey>(Arg.Is <Uri>(u => u.ToString() == "repos/user/repo/keys"), options); }
public void DeletesCorrectUrl() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); deployKeysClient.Delete("user", "repo", 42); apiConnection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repos/user/repo/keys/42")); }
public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryDeployKeysClient(connection); var options = new ApiOptions { PageCount = 1, PageSize = 1, StartPage = 1 }; await client.GetAll(1, options); connection.Received(1) .GetAll<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/keys"), options); }
public void CreatesCorrectUrlWithRepositoryId() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); var newDeployKey = new NewDeployKey { Key = "ABC123", Title = "user@repo" }; deployKeysClient.Create(1, newDeployKey); apiConnection.Received().Post<DeployKey>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/keys"), newDeployKey); }
public async Task DeletesCorrectUrlWithRepositoryId() { var apiConnection = Substitute.For<IApiConnection>(); var deployKeysClient = new RepositoryDeployKeysClient(apiConnection); await deployKeysClient.Delete(1, 42); apiConnection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "repositories/1/keys/42")); }
public async Task EnsuresNonNullArguments() { var deployKeysClient = new RepositoryDeployKeysClient(Substitute.For<IApiConnection>()); await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.Create(null, "repo", new NewDeployKey())); await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.Create("user", null, new NewDeployKey())); await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.Create("user", "repo", null)); await Assert.ThrowsAsync<ArgumentNullException>(() => deployKeysClient.Create(1, null)); await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.Create("", "repo", new NewDeployKey())); await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.Create("user", "", new NewDeployKey())); await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.Create("user", "repo", new NewDeployKey())); await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.Create("user", "repo", new NewDeployKey { Key = "ABC123" })); await Assert.ThrowsAsync<ArgumentException>(() => deployKeysClient.Create("user", "repo", new NewDeployKey { Title = "user@repo" })); }