public void IsDouble_WhenIsCorrectType_It_should_not_throw() => ShouldNotThrow(
     () => Ensure.Type.IsDouble(typeof(double), ParamName),
     () => Ensure.Type.IsDouble(42.33, ParamName),
     () => EnsureArg.IsDouble(typeof(double), ParamName),
     () => EnsureArg.IsDouble(42.33, ParamName),
     () => Ensure.ThatType(typeof(double), ParamName).IsDouble(),
     () => Ensure.ThatTypeFor(42.33, ParamName).IsDouble());
 public void IsDouble_WhenNotTypeOf_ThrowsArgumentException() => AssertIsOfTypeScenario(
     typeof(double), typeof(int),
     () => Ensure.Type.IsDouble(typeof(int), ParamName),
     () => Ensure.Type.IsDouble(42, ParamName),
     () => EnsureArg.IsDouble(typeof(int), ParamName),
     () => EnsureArg.IsDouble(42, ParamName),
     () => Ensure.ThatType(typeof(int), ParamName).IsDouble(),
     () => Ensure.ThatTypeFor(42, ParamName).IsDouble());
Esempio n. 3
0
        public void IsDouble_WhenIsCorrectType_It_should_not_throw()
        {
            var returnedValue = Ensure.ThatTypeFor(42.33, ParamName).IsDouble();

            AssertReturnedAsExpected(returnedValue, typeof(double));

            Action a = () => EnsureArg.IsDouble(typeof(double), ParamName);

            a.ShouldNotThrow();

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

            b.ShouldNotThrow();
        }