public void TestExceptionThrown() { var thrower = new ExceptionThrower(); // exception is actually thrown Assert.Throws <Project.RethrowException>(() => thrower.CreateTraceAndThrow()); }
public void TestExceptionTrace() { var thrower = new ExceptionThrower(); try { thrower.CreateTraceAndThrow(); } catch (Project.RethrowException e) { var trace = new StackTrace(e, true); // the trace contains 4 methods inside the class + the caller = 5 Assert.AreEqual(5, trace.FrameCount); } }