Microsoft.AspNet.WebHooks.WebHookReceiverConfig.AddKey C# (CSharp) Méthode

AddKey() static private méthode

static private AddKey ( string>.IDictionary config, ILogger logger, string receiver, string id, string value ) : void
config string>.IDictionary
logger ILogger
receiver string
id string
value string
Résultat void
        internal static void AddKey(IDictionary<string, string> config, ILogger logger, string receiver, string id, string value)
        {
            string lookupKey = GetConfigKey(receiver, id);

            try
            {
                config.Add(lookupKey, value);
                string msg = string.Format(CultureInfo.CurrentCulture, ReceiverResources.Config_AddedName, receiver, id);
                logger.Info(msg);
            }
            catch (Exception ex)
            {
                string msg = string.Format(CultureInfo.CurrentCulture, ReceiverResources.Config_AddFailure, receiver, id, ex.Message);
                logger.Error(msg, ex);
                throw new InvalidOperationException(msg);
            }
        }

Usage Example

Exemple #1
0
        public void AddKey_AddsItem(string receiver, string id, string key)
        {
            // Arrange
            IDictionary <string, string> config = new Dictionary <string, string>();

            // Act
            WebHookReceiverConfig.AddKey(config, _logger, receiver, id, "Value");

            // Assert
            Assert.Equal("Value", config[key]);
        }
All Usage Examples Of Microsoft.AspNet.WebHooks.WebHookReceiverConfig::AddKey