예제 #1
0
 public ProjectConfig(string features, string releases, IEnumerable<string> databases, EnvironmentsConfig environments, string tasks)
 {
     mFeatures = features;
     mReleases = releases;
     mDatabases = databases.ToArray();
     mEnvironments = environments;
     mTasks = tasks;
 }
예제 #2
0
        public ProviderState(HttpClient client, string configPath)
        {
            var pactBrokerConfig = new EnvironmentsConfig(configPath).Config;

            client.BaseAddress = new Uri(pactBrokerConfig["pactBroker:url"]);
            client.DefaultRequestHeaders.Authorization =
                new AuthenticationHeaderValue(
                    "Basic",
                    Convert.ToBase64String(
                        Encoding.ASCII.GetBytes(
                            $"{pactBrokerConfig["pactBroker:username"]}:{pactBrokerConfig["pactBroker:password"]}")));
        }
예제 #3
0
        public ProviderState(string providerName, string consumerName, string localDirectory)
        {
            _config = EnvironmentsConfig.ReadConfigurationFile();
            var client = new RestClient(_config.PactBroker.Host)
            {
                Authenticator =
                    new HttpBasicAuthenticator(_config.PactBroker.Username, _config.PactBroker.Password)
            };
            var request  = new RestRequest($"/pacts/provider/{providerName}/consumer/{consumerName}/latest", Method.GET);
            var response = client.Execute(request);

            PactContract    = JsonConvert.DeserializeObject <PactContract>(response.Content);
            _pactJson       = JObject.Parse(response.Content);
            _localDirectory = localDirectory;
        }