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"));
        }
Пример #3
0
 public void Dispose()
 {
     _stopWatch          = null;
     _loadTestHttpClient = null;
     _statusResults      = null;
 }
Пример #4
0
 public UserLoadTestHttpClient(ILoadTestHttpClient loadTestHttpClient, IDictionary <string, object> testState)
 {
     _loadTestHttpClient = loadTestHttpClient;
     TestState           = testState;
     _stopWatch          = new Stopwatch();
 }
Пример #5
0
 public Task Initialize(ILoadTestHttpClient loadLoadTestHttpClient)
 {
     return(Task.CompletedTask);
 }
Пример #6
0
 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")));
 }
Пример #7
0
        public static Task <HttpResponseMessage> Post(this ILoadTestHttpClient httpClient, string relativePath, HttpContent content = null)
        {
            content = content ?? EmptyContent();

            return(httpClient.Post(relativePath, content));
        }