public void SafeExecuteExceptTest() { var actual = ActionEx.SafeExecuteExcept <ArgumentException>(() => { }); Assert.True(actual); actual = ActionEx.SafeExecuteExcept <ArgumentException>(() => throw new InvalidCastException()); Assert.False(actual); }
public void SafeExecuteExceptTest4() { var actual = ActionEx.SafeExecuteExcept(() => { }, typeof(ArgumentException), typeof(NullReferenceException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.True(actual); actual = ActionEx.SafeExecuteExcept(() => throw new InvalidCastException(), typeof(ArgumentException), typeof(NullReferenceException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.False(actual); }
public void SafeExecuteExceptTest3() { var actual = ActionEx .SafeExecuteExcept <ArgumentException, NullReferenceException, InvalidOperationException, ArithmeticException>( () => { }); Assert.True(actual); actual = ActionEx .SafeExecuteExcept <ArgumentException, NullReferenceException, InvalidOperationException, ArithmeticException>( () => throw new InvalidCastException()); Assert.False(actual); }