public async Task ReturnsDistinctDeploymentStatusesBasedOnStartPageWithRepositoryId() { var newStatus1 = new NewDeploymentStatus(DeploymentState.Success); var newStatus2 = new NewDeploymentStatus(DeploymentState.Success); var newStatus3 = new NewDeploymentStatus(DeploymentState.Success); await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus1); await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus2); await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus3); var startOptions = new ApiOptions { PageSize = 1, PageCount = 1 }; var firstPage = await _deploymentsClient.Status.GetAll(_context.Repository.Id, _deployment.Id, startOptions); var skipStartOptions = new ApiOptions { PageSize = 1, PageCount = 1, StartPage = 2 }; var secondPage = await _deploymentsClient.Status.GetAll(_context.Repository.Id, _deployment.Id, skipStartOptions); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); }
public async Task CanCreateDeploymentStatus() { var newStatus = new NewDeploymentStatus(DeploymentState.Success); var status = await _deploymentsClient.Status.Create(_context.RepositoryOwner, _context.RepositoryName, _deployment.Id, newStatus); Assert.NotNull(status); Assert.Equal(DeploymentState.Success, status.State); }
public async Task CanReadDeploymentStatuses() { var newStatus = new NewDeploymentStatus(DeploymentState.Success); await _deploymentsClient.Status.Create(_context.RepositoryOwner, _context.RepositoryName, _deployment.Id, newStatus); var statuses = await _deploymentsClient.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, _deployment.Id); Assert.NotEmpty(statuses); Assert.Equal(DeploymentState.Success, statuses[0].State); }
public void CallsIntoDeploymentStatusClientWithRepositoryId() { SetupWithoutNonReactiveClient(); var newStatus = new NewDeploymentStatus(DeploymentState.Success); _client.Create(1, 1, newStatus); _githubClient.Repository.Deployment.Status.Received(1) .Create(1, 1, newStatus); }
public void CallsIntoDeploymentStatusClient() { SetupWithoutNonReactiveClient(); var newStatus = new NewDeploymentStatus(); _client.Create("owner", "repo", 1, newStatus); _githubClient.Repository.Deployment.Status.Received(1) .Create(Arg.Is("owner"), Arg.Is("repo"), Arg.Is(1), Arg.Is(newStatus)); }
public async Task CanReadDeploymentStatuses() { var newStatus = new NewDeploymentStatus(DeploymentState.Success) { LogUrl = "http://test.com/log", EnvironmentUrl = "http:test.com/staging" }; await _deploymentsClient.Status.Create(_context.RepositoryOwner, _context.RepositoryName, _deployment.Id, newStatus); var statuses = await _deploymentsClient.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, _deployment.Id); Assert.NotEmpty(statuses); Assert.Equal(DeploymentState.Success, statuses[0].State); Assert.Equal(newStatus.LogUrl, statuses[0].LogUrl); Assert.Equal(newStatus.EnvironmentUrl, statuses[0].EnvironmentUrl); }
/// <inheritdoc/> protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken)) { if (Owner != null && Name != null && DeploymentId != null && NewDeploymentStatus != null) { var ownerValue = Owner.GetValue(dc.State); var nameValue = Name.GetValue(dc.State); var deploymentIdValue = DeploymentId.GetValue(dc.State); var newDeploymentStatusValue = NewDeploymentStatus.GetValue(dc.State); return(await gitHubClient.Repository.Deployment.Status.Create(ownerValue, nameValue, (Int32)deploymentIdValue, newDeploymentStatusValue).ConfigureAwait(false)); } if (RepositoryId != null && DeploymentId != null && NewDeploymentStatus != null) { var repositoryIdValue = RepositoryId.GetValue(dc.State); var deploymentIdValue = DeploymentId.GetValue(dc.State); var newDeploymentStatusValue = NewDeploymentStatus.GetValue(dc.State); return(await gitHubClient.Repository.Deployment.Status.Create((Int64)repositoryIdValue, (Int32)deploymentIdValue, newDeploymentStatusValue).ConfigureAwait(false)); } throw new ArgumentNullException("Required [deploymentId,newDeploymentStatus] arguments missing for GitHubClient.Repository.Deployment.Status.Create"); }
public async Task ReturnsCorrectCountOfDeploymentStatusesWithoutStartWithRepositoryId() { var newStatus1 = new NewDeploymentStatus(DeploymentState.Success); var newStatus2 = new NewDeploymentStatus(DeploymentState.Success); var newStatus3 = new NewDeploymentStatus(DeploymentState.Success); await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus1); await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus2); await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus3); var options = new ApiOptions { PageSize = 3, PageCount = 1 }; var deploymentStatuses = await _deploymentsClient.Status.GetAll(_context.Repository.Id, _deployment.Id, options); Assert.Equal(3, deploymentStatuses.Count); }
/// <summary> /// Creates a new status for the given deployment. Users with push access can create deployment /// statuses for a given deployment. /// </summary> /// <remarks> /// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status /// </remarks> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="deploymentId">The id of the deployment.</param> /// <param name="newDeploymentStatus">The new deployment status to create.</param> /// <returns></returns> public IObservable<DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus) { return _client.Create(owner, name, deploymentId, newDeploymentStatus).ToObservable(); }
/// <summary> /// Creates a new status for the given deployment. Users with push access can create deployment /// statuses for a given deployment. /// </summary> /// <remarks> /// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status /// </remarks> /// <param name="repositoryId">The ID of the repository.</param> /// <param name="deploymentId">The id of the deployment.</param> /// <param name="newDeploymentStatus">The new deployment status to create.</param> public IObservable<DeploymentStatus> Create(int repositoryId, int deploymentId, NewDeploymentStatus newDeploymentStatus) { Ensure.ArgumentNotNull(newDeploymentStatus, "newDeploymentStatus"); return _client.Create(repositoryId, deploymentId, newDeploymentStatus).ToObservable(); }
/// <summary> /// Creates a new status for the given deployment. Users with push access can create deployment /// statuses for a given deployment. /// </summary> /// <remarks> /// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status /// </remarks> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="deploymentId">The id of the deployment.</param> /// <param name="newDeploymentStatus">The new deployment status to create.</param> public IObservable<DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(newDeploymentStatus, "newDeploymentStatus"); return _client.Create(owner, name, deploymentId, newDeploymentStatus).ToObservable(); }
/// <summary> /// Creates a new status for the given deployment. Users with push access can create deployment /// statuses for a given deployment. /// </summary> /// <remarks> /// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status /// </remarks> /// <param name="repositoryId">The Id of the repository.</param> /// <param name="deploymentId">The id of the deployment.</param> /// <param name="newDeploymentStatus">The new deployment status to create.</param> public IObservable <DeploymentStatus> Create(int repositoryId, int deploymentId, NewDeploymentStatus newDeploymentStatus) { Ensure.ArgumentNotNull(newDeploymentStatus, "newDeploymentStatus"); return(_client.Create(repositoryId, deploymentId, newDeploymentStatus).ToObservable()); }
/// <summary> /// Creates a new status for the given deployment. Users with push access can create deployment /// statuses for a given deployment. /// </summary> /// <remarks> /// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status /// </remarks> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="deploymentId">The id of the deployment.</param> /// <param name="newDeploymentStatus">The new deployment status to create.</param> public IObservable <DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(newDeploymentStatus, "newDeploymentStatus"); return(_client.Create(owner, name, deploymentId, newDeploymentStatus).ToObservable()); }
/// <summary> /// Creates a new status for the given deployment. Users with push access can create deployment /// statuses for a given deployment. /// </summary> /// <remarks> /// http://developer.github.com/v3/repos/deployments/#create-a-deployment-status /// </remarks> /// <param name="owner">The owner of the repository.</param> /// <param name="name">The name of the repository.</param> /// <param name="deploymentId">The id of the deployment.</param> /// <param name="newDeploymentStatus">The new deployment status to create.</param> /// <returns></returns> public IObservable <DeploymentStatus> Create(string owner, string name, int deploymentId, NewDeploymentStatus newDeploymentStatus) { return(_client.Create(owner, name, deploymentId, newDeploymentStatus).ToObservable()); }