Added more tests and refactoring to make cursor.setReadPreference work correctly