Example #1
0
        public virtual async Task <TestLroOperation> GetLroAsync(bool waitForCompletion, bool exceptionOnWait = false, CancellationToken cancellationToken = default)
        {
            using var scope = _diagnostic.CreateScope("TestResource.GetLro");
            scope.Start();

            try
            {
                var lro = new TestLroOperation(new TestResource(), exceptionOnWait);
                if (waitForCompletion)
                {
                    await lro.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(lro);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #2
0
        public virtual TestLroOperation StartLongLro(bool waitForCompletion, CancellationToken cancellationToken = default)
        {
            using var scope = _diagnostic.CreateScope("TestResource.StartLongLro");
            scope.Start();

            try
            {
                var lro = new TestLroOperation(new TestResource(), delaySteps: 10);
                if (waitForCompletion)
                {
                    lro.WaitForCompletion(cancellationToken);
                }
                return(lro);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }
Example #3
0
        public async virtual Task <TestLroOperation> StartLongLroAsync(bool waitForCompletion, CancellationToken cancellationToken = default)
        {
            using var scope = _diagnostic.CreateScope("TestResource.StartLongLro");
            scope.Start();

            try
            {
                await Task.Delay(1);

                var lro = new TestLroOperation(new TestResource(), delaySteps: 10);
                if (waitForCompletion)
                {
                    await lro.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
                }
                return(lro);
            }
            catch (Exception e)
            {
                scope.Failed(e);
                throw;
            }
        }