Esempio n. 1
0
 public static void DoesNotThrow(ThrowsAction action)
 {
     try
     {
         action.Invoke();
     }
     catch (Exception ex)
     {
         Fail(ex.Message);
     }
 }
Esempio n. 2
0
 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.");
 }
Esempio n. 3
0
        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.");
        }