public static void Throws <T>(MyTestDelegate d) where T : Exception { try { d(); } catch (Exception e) { #if USEING_NUNIT Assert.IsInstanceOf <T>(e); #else Assert.IsInstanceOfType(e, typeof(T)); #endif } }