public static void DoesNotThrow(ThrowsAction action) { try { action.Invoke(); } catch (Exception ex) { Fail(ex.Message); } }
public static void Throws(ThrowsAction action, Type exceptionType) { try { action.Invoke(); } catch (Exception ex) { if (ex.GetType() == exceptionType) return; throw; } Fail("Expected exception of type " + exceptionType.Name + " was not thrown."); }
public static void Throws(ThrowsAction action, Type exceptionType) { try { action.Invoke(); } catch (Exception ex) { if (ex.GetType() == exceptionType) { return; } throw; } Fail("Expected exception of type " + exceptionType.Name + " was not thrown."); }