示例#1
0
        public static string GetStepDom(EyesBase eyes, ActualAppOutput actualAppOutput)
        {
            ArgumentGuard.NotNull(eyes, nameof(eyes));
            ArgumentGuard.NotNull(actualAppOutput, nameof(actualAppOutput));

            UriBuilder uriBuilder = new UriBuilder(eyes.ServerUrl);

            uriBuilder.Path = $"/api/images/dom/{actualAppOutput.Image.DomId}";

            NameValueCollection query = HttpUtility.ParseQueryString(uriBuilder.Query);

            query["apiKey"]  = eyes.ApiKey;
            uriBuilder.Query = query.ToString();
            HttpRestClient client = new HttpRestClient(uriBuilder.Uri);

            client.ConfigureRequest += Client_ConfigureRequest;
            HttpWebResponse response = client.GetJson(uriBuilder.ToString());
            Stream          stream   = response.GetResponseStream();
            string          result;

            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
            {
                result = reader.ReadToEnd();
            }
            client.ConfigureRequest -= Client_ConfigureRequest;
            return(result);
        }