Refactor tests to use shared context.