private static async Task <AgentResult> RunRequestComparisonAsync(int threads, HttpRequestTree requestTree, ResultComparerFactory comparerFactory) { CancellationTokenSource source = new CancellationTokenSource(); var token = source.Token; Console.CancelKeyPress += delegate { source.Cancel(); }; var agent = new RequestTreeAgent(requestTree, comparerFactory); return(await agent.Run(threads, token)); }
public async Task PreRequests() { var resourceStream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("Fenrir.Core.Tests.Resources.test-pre-then-get.json"); HttpRequestTree requestTree; using (var reader = new StreamReader(resourceStream, Encoding.UTF8)) { requestTree = JsonConvert.DeserializeObject <HttpRequestTree>(reader.ReadToEnd()); } RequestTreeAgent agent = new RequestTreeAgent(requestTree); var result = await agent.Run(1); Assert.True(result != null); Assert.True(result.Stats.StatusCodes[201] == 1); Assert.True(result.Stats.StatusCodes[200] == 1); }