/// <summary> /// Initializes a new instance of the <see cref="PopulationReplacementValue"/> class. /// </summary> /// <param name="value">Number of <see cref="GeneticEntity"/> objects to be replaced.</param> /// <param name="kind"> /// Kind of value being used to indicate the number of <see cref="GeneticEntity"/> objects to replace. /// </param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is less than zero.</exception> public PopulationReplacementValue(int value, ReplacementValueKind kind) { if (value < 0) { throw new ArgumentOutOfRangeException(nameof(value), value, StringUtil.GetFormattedString( Resources.ErrorMsg_PopulationReplacementValue_LessThanZero, value)); } if (!Enum.IsDefined(typeof(ReplacementValueKind), kind)) { throw EnumHelper.CreateUndefinedEnumException(typeof(ReplacementValueKind), "kind"); } this.replacementValue = value; this.kind = kind; }
public void EnumHelper_CreateUndefinedEnumException_NullType() { Assert.Throws <ArgumentNullException>(() => EnumHelper.CreateUndefinedEnumException(null, "foo")); }
public void EnumHelper_CreateUndefinedEnumException() { ArgumentException exception = EnumHelper.CreateUndefinedEnumException(typeof(FitnessEvaluationMode), "foo"); Assert.Equal("foo", exception.ParamName); }