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