public static async void Cancel() { PortalClient portalClient = null; //As initialized earlier Job portalJob = null; //As initialized earlier var portalJobResponse = await portalClient.Create(portalJob); await portalClient.Cancel(portalJobResponse.CancellationReference); }
public async Task Throws_job_completed_exception_on_conflict() { //Arrange var portalClient = new PortalClient(GetClientConfiguration()) { HttpClient = GetHttpClientWithHandler(new FakeHttpClientHandlerForJobCompletedResponse()) }; //Act await Assert.ThrowsAsync <JobCompletedException>(async() => await portalClient.Cancel(new CancellationReference(new Uri("http://cancellationuri.no"))).ConfigureAwait(false)).ConfigureAwait(false); }
public async Task Throws_unexpected_error_on_unexpected_error_code() { //Arrange var portalClient = new PortalClient(GetClientConfiguration()) { HttpClient = GetHttpClientWithHandler(new FakeHttpClientHandlerForInternalServerErrorResponse()) }; //Act await Assert.ThrowsAsync <UnexpectedResponseException>(async() => await portalClient.Cancel(new CancellationReference(new Uri("http://cancellationuri.no"))).ConfigureAwait(false)).ConfigureAwait(false); }
public TestHelper Cancel_job() { _client.Cancel(_cancellationReference).ConfigureAwait(false).GetAwaiter().GetResult(); return(this); }