示例#1
0
        public static void ShouldBeThrownBy(this Type exceptionType, ThrowingAction expressionThatThrows)
        {
            Exception e = null;

            try
            {
                expressionThatThrows.Invoke();
            }
            catch (Exception ex)
            {
                e = ex;
            }

            e.ShouldNotBeNull();
            e.ShouldBeInstanceOfType(exceptionType);
        }
        public static void ShouldBeThrownBy(this Type exceptionType, ThrowingAction action)
        {
            Exception e = null;

            try
            {
                action.Invoke();
            }
            catch (Exception ex)
            {
                e = ex;
            }

            e.ShouldNotBeNull();
            e.ShouldBeType(exceptionType);
        }