public void IsBool_WhenNotTypeOf_ThrowsArgumentException() => AssertIsOfTypeScenario(
     typeof(bool), typeof(int),
     () => Ensure.Type.IsBool(typeof(int), ParamName),
     () => Ensure.Type.IsBool(42, ParamName),
     () => EnsureArg.IsBool(typeof(int), ParamName),
     () => EnsureArg.IsBool(42, ParamName),
     () => Ensure.ThatType(typeof(int), ParamName).IsBool(),
     () => Ensure.ThatTypeFor(42, ParamName).IsBool());
Esempio n. 2
0
        public void IsBool_WhenIsCorrectType_It_should_not_throw()
        {
            const bool value = true;

            ShouldNotThrow(
                () => Ensure.ThatTypeFor(value, ParamName).IsBool(),
                () => EnsureArg.IsBool(typeof(bool), ParamName),
                () => EnsureArg.IsBool(value, ParamName));
        }
Esempio n. 3
0
        public void IsBool_WhenIsCorrectType_It_should_not_throw()
        {
            const bool value = true;

            var returnedValue = Ensure.ThatTypeFor(value, ParamName).IsBool();

            AssertReturnedAsExpected(returnedValue, typeof(bool));

            Action a = () => EnsureArg.IsBool(typeof(bool), ParamName);

            a.ShouldNotThrow();

            Action b = () => EnsureArg.IsBool(value, ParamName);

            b.ShouldNotThrow();
        }