Exemplo n.º 1
0
        /// <inheritdoc/>
        /// <exception cref="T:System.ArgumentNullException"><paramref name="option"/> is <see langword="null"/></exception>
        public bool Contains(IDiceRollOption option)
        {
            if (option == null)
            {
                throw new ArgumentNullException(nameof(option));
            }

            return(Options.Contains(option));
        }
Exemplo n.º 2
0
        /// <exception cref="ArgumentNullException"></exception>
        /// <inheritdoc/>
        /// <exception cref="T:Org.Edgerunner.Dice.Exceptions.OptionConflictException">Dice roll options may not contain two options of the same option type.</exception>
        public IDiceRollOptions Add(IDiceRollOption option)
        {
            if (option == null)
            {
                throw new ArgumentNullException(nameof(option));
            }

            if (OptionsKeyed.ContainsKey(option.OptionType))
            {
                throw new OptionConflictException("Dice roll options may not contain two options of the same option type.");
            }

            Options.Add(option);
            OptionsKeyed[option.OptionType] = option;
            return(this);
        }