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