public void WhenParamNamePassedIn_ThenSetExceptionParamName() { var ex = Assert.Throws <ArgumentOutOfRangeException>(() => ArgMustBe.In(ParamValue, new[] { 2, 3 }, ParamName)); Assert.That(ex.Message, Is.EqualTo($"Parameter value: '{ParamValue}' was not in the allowed sequence of values. (Parameter '{ParamName}')")); Assert.That(ex.ParamName, Is.EqualTo(ParamName)); }
public void WhenParamValueIsNotInValues_ThenThrowException() { var ex = Assert.Throws <ArgumentOutOfRangeException>(() => ArgMustBe.In(ParamValue, new[] { 2, 3 })); Assert.That(ex.Message, Is.EqualTo($"Parameter value: '{ParamValue}' was not in the allowed sequence of values.")); Assert.That(ex.ParamName, Is.Null); }
public void WhenValuesIsNull_ThenDoesNotThrowException() { Assert.DoesNotThrow(() => ArgMustBe.In(ParamValue, null)); }
public void WhenValuesIsEmpty_ThenDoesNotThrowException() { Assert.DoesNotThrow(() => ArgMustBe.In(ParamValue, Enumerable.Empty <int>())); }
public void WhenParamValueIsInValues_ThenDoNotThrowException() { Assert.DoesNotThrow(() => ArgMustBe.In(ParamValue, new[] { 2, 1, 3 })); }