fix reversed commit call
add InMemoryDB and MessageWriter unit test