public void SafeExecuteTest5_1() { var actual = ActionEx .SafeExecute(() => { }, typeof(ArgumentNullException), typeof(ArgumentOutOfRangeException), typeof(InvalidCastException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.True(actual); actual = ActionEx .SafeExecute(() => throw new ArgumentNullException(), typeof(ArgumentNullException), typeof(ArgumentOutOfRangeException), typeof(InvalidCastException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.False(actual); actual = ActionEx .SafeExecute(() => throw new ArgumentOutOfRangeException(), typeof(ArgumentNullException), typeof(ArgumentOutOfRangeException), typeof(InvalidCastException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.False(actual); actual = ActionEx .SafeExecute(() => throw new InvalidCastException(), typeof(ArgumentNullException), typeof(ArgumentOutOfRangeException), typeof(InvalidCastException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.False(actual); actual = ActionEx.SafeExecute(() => throw new InvalidOperationException(), typeof(ArgumentNullException), typeof(ArgumentOutOfRangeException), typeof(InvalidCastException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.False(actual); actual = ActionEx.SafeExecute(() => throw new ArithmeticException(), typeof(ArgumentNullException), typeof(ArgumentOutOfRangeException), typeof(InvalidCastException), typeof(InvalidOperationException), typeof(ArithmeticException)); Assert.False(actual); }
public void SafeExecuteTest1_1() { var actual = ActionEx.SafeExecute <ArgumentNullException>(() => { }); Assert.True(actual); actual = ActionEx.SafeExecute <ArgumentNullException>(() => throw new ArgumentNullException()); Assert.False(actual); }
public void SafeExecuteTest() { var actual = ActionEx.SafeExecute(() => { }); Assert.True(actual); actual = ActionEx.SafeExecute(() => throw new Exception()); Assert.False(actual); }
public void SafeExecuteTest4_1() { var actual = ActionEx .SafeExecute <ArgumentNullException, ArgumentOutOfRangeException, InvalidCastException, InvalidOperationException >(() => { }); Assert.True(actual); actual = ActionEx .SafeExecute <ArgumentNullException, ArgumentOutOfRangeException, InvalidCastException, InvalidOperationException >(() => throw new ArgumentNullException()); Assert.False(actual); actual = ActionEx .SafeExecute <ArgumentNullException, ArgumentOutOfRangeException, InvalidCastException, InvalidOperationException >(() => throw new ArgumentOutOfRangeException()); Assert.False(actual); actual = ActionEx .SafeExecute <ArgumentNullException, ArgumentOutOfRangeException, InvalidCastException, InvalidOperationException >(() => throw new InvalidCastException()); Assert.False(actual); actual = ActionEx .SafeExecute <ArgumentNullException, ArgumentOutOfRangeException, InvalidCastException, InvalidOperationException >(() => throw new InvalidOperationException()); Assert.False(actual); }