Ejemplo n.º 1
0
        private async Task LoginUserByHttpClientAsync(LoginRequest loginRequest, int step, ConcurrentBag <int> failedList)
        {
            try
            {
                using (var client = new TestsClient(new Uri("http://localhost:54395/")))
                {
                    client.HttpClient.Timeout = TimeSpan.FromSeconds(300);
                    var result = await client.DemoOperations.LoginAsync(loginRequest);

                    if (!result?.Success ?? false)
                    {
                        failedList.Add(step);
                    }
                }
            }
            catch (Exception)
            {
                failedList.Add(step);
            }
        }
Ejemplo n.º 2
0
        private async Task RegisterUserByHttpClientAsync(int step, ConcurrentBag <int> failedList)
        {
            try
            {
                using (var client = new TestsClient(new Uri("http://localhost:54395/")))
                {
                    client.HttpClient.Timeout = TimeSpan.FromSeconds(300);
                    var result = await client.DemoOperations.RegisterUserAsync(new Models.RegisterUserRequest
                    {
                        UserName = $"Test{DateTime.Now.Ticks}{step}",
                        Password = "******"
                    });

                    if (!result?.Success ?? false)
                    {
                        failedList.Add(step);
                    }
                }
            }
            catch (Exception)
            {
                failedList.Add(step);
            }
        }