public async Task  setup_scenario()
 {
     using (var webApi = new PingHttpApi())
         using (var httpClient = webApi.CreateClientWithInstrumenting(_callback))
         {
             await httpClient.GetAsync("/ping");
         }
 }
        private async Task act(string uri, string eventUri)
        {
            using (var webApi = new PingHttpApi())
                using (var httpClient = webApi.CreateClientWithInstrumenting(_callback))
                {
                    _eventUri = new Uri(webApi.BaseUri, eventUri).ToString();

                    _response = await httpClient.GetAsync(uri);
                }
        }
        public async Task  setup_scenario()
        {
            using (var webApi = new PingHttpApi {
                Method = "POST"
            })
                using (var httpClient = webApi.CreateClientWithInstrumenting(_callback))
                {
                    _eventUri = new Uri(webApi.BaseUri, "/ping").ToString();

                    var request = new HttpRequestMessage(HttpMethod.Post, "/ping");

                    _response = await httpClient.SendAsync(request, CancellationToken.None);
                }
        }
 public async Task setup_scenario()
 {
     using (var webApi = new PingHttpApi {
         Latency = 2000
     })
         using (var httpClient = webApi.CreateClientWithInstrumenting(_callback, timeoutMs: 50))
         {
             try
             {
                 await httpClient.GetAsync("/ping");
             }
             catch
             {
                 // Ignore the exception;
             }
         }
 }
コード例 #5
0
        public async Task  setup_scenario()
        {
            using (var webApi = new PingHttpApi {
                Latency = 2000
            })
                using (var httpClient = webApi.CreateClientWithInstrumenting(_callback))
                {
                    _eventUri = new Uri(webApi.BaseUri, "/ping").ToString();

                    try
                    {
                        await httpClient.GetAsync("/ping", new CancellationTokenSource(TimeSpan.FromMilliseconds(20)).Token);
                    }
                    catch (Exception e)
                    {
                        _timeoutException = e;
                    }
                }
        }
コード例 #6
0
        public async Task setup_scenario()
        {
            using (var webApi = new PingHttpApi {
                Latency = 2000
            })
                using (var httpClient = webApi.CreateClientWithInstrumenting(_callback, timeoutMs: 50))
                {
                    _eventUri = new Uri(webApi.BaseUri, "/ping").ToString();

                    try
                    {
                        await httpClient.GetAsync("/ping");
                    }
                    catch (Exception e)
                    {
                        _timeoutException = e;
                    }
                }
        }