/// <inheritdoc /> public void Add(TForward key, TReverse value) { if (!TryAdd(key, value)) { throw ExceptionsHelper.NewDuplicateKeyException(key, nameof(Add)); } }
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); }