示例#1
0
            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));
            }
示例#2
0
            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);
            }
示例#3
0
 public void WhenValuesIsNull_ThenDoesNotThrowException()
 {
     Assert.DoesNotThrow(() => ArgMustBe.In(ParamValue, null));
 }
示例#4
0
 public void WhenValuesIsEmpty_ThenDoesNotThrowException()
 {
     Assert.DoesNotThrow(() => ArgMustBe.In(ParamValue, Enumerable.Empty <int>()));
 }
示例#5
0
 public void WhenParamValueIsInValues_ThenDoNotThrowException()
 {
     Assert.DoesNotThrow(() => ArgMustBe.In(ParamValue, new[] { 2, 1, 3 }));
 }