public UserLoadTestHttpClient(ILoadTestHttpClient loadTestHttpClient, IDictionary <string, object> testState, Func <TimeSpan> getCurrentTimeSpan) { _loadTestHttpClient = loadTestHttpClient; _getCurrentTimeSpan = getCurrentTimeSpan; TestState = testState; _stopWatch = new Stopwatch(); }
// Example of initialing TestState by using the client itself public async Task Initialize(ILoadTestHttpClient loadLoadTestHttpClient) { var posts = (await loadLoadTestHttpClient.Get("posts?_start=0&_limit=1")).AsJson(); var post = posts.FirstOrDefault(); if (post == null) { throw new Exception("Failing finding a post"); } loadLoadTestHttpClient.TestState.Add(PostId, post.Value <string>("id")); }
public void Dispose() { _stopWatch = null; _loadTestHttpClient = null; _statusResults = null; }
public UserLoadTestHttpClient(ILoadTestHttpClient loadTestHttpClient, IDictionary <string, object> testState) { _loadTestHttpClient = loadTestHttpClient; TestState = testState; _stopWatch = new Stopwatch(); }
public Task Initialize(ILoadTestHttpClient loadLoadTestHttpClient) { return(Task.CompletedTask); }
public static Task <HttpResponseMessage> Put(this ILoadTestHttpClient httpClient, string relativePath, IDictionary <string, object> content) { return(httpClient.Put(relativePath, new StringContent(JsonConvert.SerializeObject(content), Encoding.UTF8, "application/json"))); }
public static Task <HttpResponseMessage> Post(this ILoadTestHttpClient httpClient, string relativePath, HttpContent content = null) { content = content ?? EmptyContent(); return(httpClient.Post(relativePath, content)); }