Exemplo n.º 1
0
 public void IsDecimal_WhenIsCorrectType_It_should_not_throw() => ShouldNotThrow(
     () => Ensure.Type.IsDecimal(typeof(decimal), ParamName),
     () => Ensure.Type.IsDecimal(42.33m, ParamName),
     () => EnsureArg.IsDecimal(typeof(decimal), ParamName),
     () => EnsureArg.IsDecimal(42.33m, ParamName),
     () => Ensure.ThatType(typeof(decimal), ParamName).IsDecimal(),
     () => Ensure.ThatTypeFor(42.33m, ParamName).IsDecimal());
Exemplo n.º 2
0
 public void IsDecimal_WhenNotTypeOf_ThrowsArgumentException() => AssertIsOfTypeScenario(
     typeof(decimal), typeof(int),
     () => Ensure.Type.IsDecimal(typeof(int), ParamName),
     () => Ensure.Type.IsDecimal(42, ParamName),
     () => EnsureArg.IsDecimal(typeof(int), ParamName),
     () => EnsureArg.IsDecimal(42, ParamName),
     () => Ensure.ThatType(typeof(int), ParamName).IsDecimal(),
     () => Ensure.ThatTypeFor(42, ParamName).IsDecimal());
Exemplo n.º 3
0
        public void IsDecimal_WhenIsCorrectType_It_should_not_throw()
        {
            var returnedValue = Ensure.ThatTypeFor(42.33m, ParamName).IsDecimal();

            AssertReturnedAsExpected(returnedValue, typeof(decimal));

            Action a = () => EnsureArg.IsDecimal(typeof(decimal), ParamName);

            a.ShouldNotThrow();

            Action b = () => EnsureArg.IsDecimal(42.33m, ParamName);

            b.ShouldNotThrow();
        }