AddKey() static private method

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
return void
Example #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]);
        }
Example #2
0
        public void AddKey_ThrowsOnDuplicateKey()
        {
            // Arrange
            IDictionary <string, string> config = new Dictionary <string, string>();

            WebHookReceiverConfig.AddKey(config, _logger, "Receiver", "Id", "Value");

            // Act
            InvalidOperationException ioex = Assert.Throws <InvalidOperationException>(() => WebHookReceiverConfig.AddKey(config, _logger, "Receiver", "Id", "Value"));

            // Assert
            Assert.Equal("Could not add configuration for receiver 'Receiver' and id 'Id': An item with the same key has already been added.", ioex.Message);
        }