public void read_impl_should_not_be_invoked_again_having_previously_thrown_an_exception_and_same_exception_should_be_re_thrown() { Exception caught = null; var reader = new ThrowingMessageReader(); try { reader.Read(); Assert.True(false, "Read should have thrown."); } catch(Exception exc) { caught = exc; } try { reader.Read(); Assert.True(false, "Read should have thrown."); } catch(Exception exc) { Assert.Same(caught, exc); } }
public void the_stack_trace_trace_of_a_previously_throw_exception_is_preserved() { var reader = new ThrowingMessageReader(); for(int i = 0; i < 2; ++i) { try { reader.Read(); Assert.True(false, "Read should have thrown."); } catch(Exception exc) { Assert.Contains("ThrowingMessageReader.ThrowException", exc.StackTrace); } } }