You should not wrap all the statements in the try catch block, only the context.commit. If you do all the statements, you don't know which statement caused the exception and your test will not detect if it was something else than commitTransaction.