Exemplo n.º 1
0
 public void IsClass_WhenIsNotClass_ThrowsArgumentException() => AssertIsNotClass(
     typeof(int),
     () => Ensure.Type.IsClass(typeof(int), ParamName),
     () => Ensure.Type.IsClass(42, ParamName),
     () => EnsureArg.IsClass(typeof(int), ParamName),
     () => EnsureArg.IsClass(42, ParamName),
     () => Ensure.ThatType(typeof(int), ParamName).IsClass(),
     () => Ensure.ThatTypeFor(42, ParamName).IsClass());
Exemplo n.º 2
0
 public void IsClass_WhenPassingNull_ThrowsArgumentNullException()
 {
     AssertAll <ArgumentNullException>(
         ExceptionMessages.Types_IsClass_Failed_Null,
         () => Ensure.That(null as Type, ParamName).IsClass(),
         () => EnsureArg.IsClass(null, ParamName),
         () => EnsureArg.IsClass((Type)null, ParamName));
 }
Exemplo n.º 3
0
        public void IsClass_WhenIsClass_It_should_not_throw()
        {
            var value = new MyClass();

            ShouldNotThrow(
                () => Ensure.ThatTypeFor(value, ParamName).IsClass(),
                () => EnsureArg.IsClass(typeof(MyClass), ParamName),
                () => EnsureArg.IsClass(value, ParamName));
        }
Exemplo n.º 4
0
        public void IsClass_WhenIsClass_It_should_not_throw()
        {
            var value = new MyClass();

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

            AssertReturnedAsExpected(returnedValue, typeof(MyClass));

            Action a = () => EnsureArg.IsClass(typeof(MyClass), ParamName);

            a.ShouldNotThrow();

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

            b.ShouldNotThrow();
        }
Exemplo n.º 5
0
 public void IsClass_WhenPassingNull_ThrowsArgumentNullException() => ShouldThrow <ArgumentNullException>(
     ExceptionMessages.Types_IsClass_Failed_Null,
     () => Ensure.Type.IsClass(null, ParamName),
     () => EnsureArg.IsClass(null, ParamName),
     () => Ensure.ThatType(null, ParamName).IsClass());