Fix enum method and add unit tests