예제 #1
0
        public static async Task <CloudBornWebTestRunContext> InitTestEnvironment(
            TestRunSettings testRunSettings,
            TrafficSource trafficSource)
        {
            // Init the environment only once in test run
            if (testRunContext != null)
            {
                return(testRunContext);
            }

            var connectionInfo = ConnectionInfoReader.GetConnectionInfo(testRunSettings.Environment);

            var webClientBuilder = new CloudBornWebClientBuilder(connectionInfo, trafficSource);

            CloudBornWebClient webClient = webClientBuilder.Create();

            await HttpClientUtils.WaitForService(
                async() =>
            {
                await webClient.GetHealth().ConfigureAwait(false);
            },
                connectionInfo.RetryOnFailedConnection).ConfigureAwait(false);

            testRunContext = new CloudBornWebTestRunContext(connectionInfo, webClient, webClientBuilder);

            return(testRunContext);
        }