public virtual async Task <TestResourceOperationOrResponseOfT> GetLroAsync(WaitUntil waitUntil, bool exceptionOnWait = false, CancellationToken cancellationToken = default) { using var scope = _diagnostic.CreateScope("TestResource.GetLro"); scope.Start(); try { var lro = new TestResourceOperationOrResponseOfT(new TestResource(), exceptionOnWait); if (waitUntil == WaitUntil.Completed) { await lro.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(lro); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual async Task <TestResourceOperationOrResponseOfT> StartLroWrapperAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _diagnostic.CreateScope("TestResource.StartLroWrapper"); scope.Start(); try { var lro = new TestResourceOperationOrResponseOfT(new TestResource()); if (waitForCompletion) { await lro.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(lro); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual TestResourceOperationOrResponseOfT StartLongLro(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _diagnostic.CreateScope("TestResource.StartLongLro"); scope.Start(); try { var lro = new TestResourceOperationOrResponseOfT(new TestResource(), delaySteps: 10); if (waitUntil == WaitUntil.Completed) { lro.WaitForCompletion(cancellationToken); } return(lro); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual TestResourceOperationOrResponseOfT GetLro(bool waitForCompletion, bool exceptionOnWait = false, CancellationToken cancellationToken = default) { using var scope = _diagnostic.CreateScope("TestResource.GetLro"); scope.Start(); try { var lro = new TestResourceOperationOrResponseOfT(new TestResource(), exceptionOnWait); if (waitForCompletion) { lro.WaitForCompletion(cancellationToken); } return(lro); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <TestResourceOperationOrResponseOfT> StartLongLroAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _diagnostic.CreateScope("TestResource.StartLongLro"); scope.Start(); try { await Task.Delay(1); var lro = new TestResourceOperationOrResponseOfT(new TestResource(), delaySteps: 10); if (waitUntil == WaitUntil.Completed) { await lro.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(lro); } catch (Exception e) { scope.Failed(e); throw; } }