/// <inheritdoc />
 public void Add(TForward key, TReverse value)
 {
     if (!TryAdd(key, value))
     {
         throw ExceptionsHelper.NewDuplicateKeyException(key, nameof(Add));
     }
 }
Ejemplo n.º 2
0
        public void ErrorMessage_DoesMatchDefaultMessage()
        {
            var defaultMessage = ErrorMessages.ResourceManager
                                 .GetString(nameof(ErrorMessages.DuplicateKeyFound), CultureInfo.InvariantCulture);

            defaultMessage = string.Format(defaultMessage, "key", nameof(ErrorMessage_DoesMatchDefaultMessage));
            Assert.AreEqual(defaultMessage, ExceptionsHelper.NewDuplicateKeyException("key", nameof(ErrorMessage_DoesMatchDefaultMessage)).Message);
        }