GetEndpoint() public method

public GetEndpoint ( AzureEnvironment endpoint ) : string
endpoint AzureEnvironment
return string
Esempio n. 1
0
        private AzureEnvironment MergeEnvironmentProperties(AzureEnvironment environment1, AzureEnvironment environment2)
        {
            if (environment1 == null || environment2 == null)
            {
                throw new ArgumentNullException("environment1");
            }
            if (!string.Equals(environment1.Name, environment2.Name, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new ArgumentException("Environment names do not match.");
            }
            AzureEnvironment mergedEnvironment = new AzureEnvironment
            {
                Name = environment1.Name
            };

            // Merge all properties
            foreach (AzureEnvironment.Endpoint property in Enum.GetValues(typeof(AzureEnvironment.Endpoint)))
            {
                string propertyValue = environment1.GetEndpoint(property) ?? environment2.GetEndpoint(property);
                if (propertyValue != null)
                {
                    mergedEnvironment.Endpoints[property] = propertyValue;
                }
            }

            return mergedEnvironment;
        }
 private void CheckEndpoint(AzureEnvironment.Endpoint endpoint, AzureEnvironment environment, string valueToCheck)
 {
     if (environment.IsEndpointSet(endpoint))
     {
         Assert.Equal(environment.GetEndpoint(endpoint), valueToCheck);
     }
 }