public void Simple_constructor() { //Arrange var url = new Uri("http://testuri"); //Act var cancellationReference = new CancellationReference(url); //Assert Assert.Equal(url, cancellationReference.Url); }
private TestHelper Create(Job job, Sender optionalSender = null) { if (optionalSender != null) { job.Sender = optionalSender; } _job = job; _jobResponse = _client.Create(_job).Result; _cancellationReference = new CancellationReference(TransformReferenceToCorrectEnvironment(_jobResponse.CancellationReference.Url)); return(this); }
public async Task Cancel(CancellationReference cancellationReference) { var requestResult = await HttpClient.PostAsync(cancellationReference.Url, null).ConfigureAwait(false); switch (requestResult.StatusCode) { case HttpStatusCode.OK: _logger.LogDebug($"PortalJob cancelled successfully [CancellationReference: {cancellationReference.Url}]."); break; case HttpStatusCode.Conflict: _logger.LogDebug($"PortalJob was not cancelled. Job was already completed [CancellationReference: {cancellationReference.Url}]."); throw new JobCompletedException(); default: throw RequestHelper.HandleGeneralException(requestResult.StatusCode, await requestResult.Content.ReadAsStringAsync().ConfigureAwait(false)); } }
public JobResponse(long jobId, string jobReference, Uri cancellationUrl) { JobId = jobId; JobReference = jobReference; CancellationReference = new CancellationReference(cancellationUrl); }