public void WhenValueIsNotBetween_AndParamNameProvided_ThenThrowException() { var ex = Assert.Throws <ArgumentOutOfRangeException>(() => ArgMustBe.Between(ParamValue, 1, 2, ParamName)); Assert.That(ex.Message, Is.EqualTo($"Parameter value: '{ParamValue}' was not between '1' and '2'. (Parameter '{ParamName}')")); Assert.That(ex.ParamName, Is.EqualTo(ParamName)); }
public void WhenValueIsNotBetween_ThenThrowException(int from, int to) { var ex = Assert.Throws <ArgumentOutOfRangeException>(() => ArgMustBe.Between(ParamValue, from, to)); Assert.That(ex.Message, Is.EqualTo($"Parameter value: '{ParamValue}' was not between '{from}' and '{to}'.")); Assert.That(ex.ParamName, Is.Null); }
public void WhenValueIsBetween_ThenDoNotThrowException(int from, int to) { Assert.DoesNotThrow(() => ArgMustBe.Between(ParamValue, from, to)); }
public void WhenFromIsGreaterThanTo_ThenThrowException() { var ex = Assert.Throws <ArgumentException>(() => ArgMustBe.Between(ParamValue, 2, 1)); Assert.That(ex.Message, Is.EqualTo("Range from value should be less than or equal to the range to value.")); }