public async Task ExecuteGETsInParallel()
        {
            var testServer = new IntegrationTestServer();

            var semaphoreSlim = new SemaphoreSlim(4);
            var times         = Enumerable.Range(0, 100);

            var trackedTasks = new List <Task>();

            foreach (var time in times)
            {
                //await semaphoreSlim.WaitAsync();
                trackedTasks.Add(Task.Run(async() =>
                {
                    var response = await testServer.GetAsync("api/characters/name/bowser/moves");
                    response.EnsureSuccessStatusCode();

                    string content = await response.Content.ReadAsStringAsync();

                    var parsedContent = JsonConvert.DeserializeObject <List <Move> >(content);
                    Console.WriteLine($"request # {time} -> {parsedContent[0].Owner}");
                    Assert.That(parsedContent[0].Owner, Is.EqualTo("Bowser"));
                    semaphoreSlim.Release();
                }));
            }

            await Task.WhenAll(trackedTasks);
        }
Example #2
0
        public async Task ExpandSetToTrueReturnsResourceWithExtraMoveProperties_Collections(string endpoint)
        {
            var response = await _testServer.GetAsync(endpoint);

            var moves = JsonConvert.DeserializeObject <List <dynamic> >(await response.Content.ReadAsStringAsync());

            //throws don't have hitboxactive or base damage values
            foreach (var move in GetMovesExceptThrows(moves))
            {
                AssertExpandedSingleIsValid(move);
            }
        }