public async Task Test6() { FlowGeneratorC flowGenerator = new FlowGeneratorC(9, 6, 3); int nodeCount = 200; Flow[] flows = flowGenerator.generateNodes(nodeCount); Console.WriteLine("Количество узлов " + nodeCount); Console.WriteLine("Количество потоков " + flows.Length); RequestBody requestBody = new RequestBody() { Flows = flows, count = flows.Length }; string jsonBody = JsonSerializer.Serialize <RequestBody>(requestBody); HttpContent req = new StringContent( jsonBody, Encoding.UTF8, "application/json" ); // Act var response = await _client.PostAsync("/api/balance/calculate", req); response.EnsureSuccessStatusCode(); string responseString = await response.Content.ReadAsStringAsync(); var res = JsonSerializer.Deserialize <BalanceResponse>(responseString); // Assert Assert.IsTrue(res.BalanceResolved); }
public async Task Test5() { Stopwatch stopwatch1 = new Stopwatch(); stopwatch1.Start(); FlowGeneratorC flowGenerator = new FlowGeneratorC(9, 9, 9); int nodeCount = 800; Flow[] flows = flowGenerator.generateNodes(nodeCount); Console.WriteLine("Количество узлов " + nodeCount); Console.WriteLine("Количество потоков " + flows.Length); RequestBody requestBody = new RequestBody() { Flows = flows, count = flows.Length }; string jsonBody = JsonSerializer.Serialize <RequestBody>(requestBody); stopwatch1.Stop(); Console.WriteLine("Потрачено тактов на генерацию: " + (stopwatch1.ElapsedMilliseconds)); Stopwatch stopwatch2 = new Stopwatch(); stopwatch2.Start(); HttpContent req = new StringContent( jsonBody, Encoding.UTF8, "application/json" ); // Act var response = await _client.PostAsync("/api/balance/calculate", req); response.EnsureSuccessStatusCode(); string responseString = await response.Content.ReadAsStringAsync(); stopwatch2.Stop(); Console.WriteLine("Потрачено тактов на рассчет: " + (stopwatch2.ElapsedMilliseconds)); var res = JsonSerializer.Deserialize <BalanceResponse>(responseString); // Assert Assert.IsTrue(res.BalanceResolved); }