Example #1
0
        private static void ValidateServerUrlAndApiKey_(IWebDriver driver, EyesRunner runner, Eyes eyes)
        {
            try
            {
                eyes.Open(driver, "app", "test");
                eyes.CheckWindow();
                eyes.Close();
            }
            finally
            {
                driver.Quit();
            }
            MockServerConnector          serverConnector = (MockServerConnector)runner.ServerConnector;
            MockMessageProcessingHandler handler         = ((MockHttpRestClientFactory)serverConnector.HttpRestClientFactory).Provider.Handler;
            int i = 0;

            foreach (HttpRequestMessage req in handler.Requests)
            {
                if (req.Method == HttpMethod.Put)
                {
                    continue;
                }
                ++i;
                StringAssert.Contains("apiKey=someApiKey", req.RequestUri.AbsoluteUri);
                StringAssert.StartsWith("https://some.server.url.com", req.RequestUri.AbsoluteUri);
            }
            Assert.Greater(i, 0);

            Assert.AreEqual("someApiKey", serverConnector.ApiKey);
            Assert.AreEqual("https://some.server.url.com/", serverConnector.ServerUrl.AbsoluteUri);

            Assert.AreEqual("someApiKey", eyes.ApiKey);
            Assert.AreEqual("https://some.server.url.com/", eyes.ServerUrl);

            Assert.AreEqual("someApiKey", runner.ApiKey);
            Assert.AreEqual("https://some.server.url.com/", runner.ServerUrl);
        }
        public MockHttpClientProvider()
        {
            HttpMessageHandler handler = new MockMessageProcessingHandler();

            httpClient_ = new HttpClient(handler);
        }
 public MockHttpClientProvider(bool?isNew, HttpStatusCode?statusCode, int?[] retryAfter, string[] pollingUrls)
 {
     Handler     = new MockMessageProcessingHandler(isNew, statusCode, retryAfter, pollingUrls);
     httpClient_ = new HttpClient(Handler);
 }