Refactor tests to use doubles