/// <summary>
        /// Adds the given role settings to the specified configuration file.
        /// </summary>
        /// <param name="role">The role settings instance</param>
        /// <param name="env">The environment</param>
        public void AddRoleToConfiguration(RoleSettings role, DevEnv env)
        {
            Validate.ValidateNullArgument(role, string.Format(Resources.NullRoleSettingsMessage, "ServiceConfiguration"));

            ServiceConfiguration config = (env == DevEnv.Cloud) ? CloudConfig : LocalConfig;

            if (config.Role == null)
            {
                config.Role = new RoleSettings[] { role };
            }
            else
            {
                config.Role = config.Role.Concat(new RoleSettings[] { role }).ToArray();
            }
        }
        private static void AddCacheConfiguration(RoleSettings cacheRoleSettings, string connectionString = "")
        {
            List<ConfigConfigurationSetting> cachingConfigSettings = new List<ConfigConfigurationSetting>();
            cachingConfigSettings.Add(new ConfigConfigurationSetting
            {
                name = Resources.NamedCacheSettingName,
                value = Resources.NamedCacheSettingValue
            });
            cachingConfigSettings.Add(new ConfigConfigurationSetting
            {
                name = Resources.DiagnosticLevelName,
                value = Resources.DiagnosticLevelValue
            });
            cachingConfigSettings.Add(new ConfigConfigurationSetting
            {
                name = Resources.CachingCacheSizePercentageSettingName,
                value = string.Empty
            });
            cachingConfigSettings.Add(new ConfigConfigurationSetting
            {
                name = Resources.CachingConfigStoreConnectionStringSettingName,
                value = connectionString
            });

            cacheRoleSettings.ConfigurationSettings = GeneralUtilities.ExtendArray<ConfigConfigurationSetting>(
                cacheRoleSettings.ConfigurationSettings,
                cachingConfigSettings);
        }
 private static void AddClientDiagnosticLevelToConfig(RoleSettings roleSettings)
 {
     ConfigConfigurationSetting clientDiagnosticLevel = new ConfigConfigurationSetting { name = Resources.ClientDiagnosticLevelName, value = Resources.ClientDiagnosticLevelValue };
     roleSettings.ConfigurationSettings = GeneralUtilities.ExtendArray<ConfigConfigurationSetting>(roleSettings.ConfigurationSettings, clientDiagnosticLevel);
 }
 private static void AssertConfigExists(RoleSettings role, string connectionString = "")
 {
     AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.NamedCacheSettingName, value = Resources.NamedCacheSettingValue }, role.ConfigurationSettings);
     AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.DiagnosticLevelName, value = Resources.DiagnosticLevelValue }, role.ConfigurationSettings);
     AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.CachingCacheSizePercentageSettingName, value = string.Empty }, role.ConfigurationSettings);
     AzureAssert.ConfigurationSettingExist(new ConfigConfigurationSetting { name = Resources.CachingConfigStoreConnectionStringSettingName, value = connectionString }, role.ConfigurationSettings);
 }