Tests for ID generation

The tests currently fail.
Bugfix: ID generation was stuck on same ID

This fixes the broken IG generation tests.
Various event store tests

The tests currently fail.
Bugfix: Seeking among events, not streams
Query: Only breaking on ToId if it's set

...in reality this would not happen since the if condition would ever be
true unless toId is non-nil. This change is mostly to make the code more
clear.
Bugfix: Breaking out of Query loop correctly
Bugfix: Return correct data on event store Query
Splitting up event store logic

This improves code structure and makes separation of concerns more
clear. No logic/functionality has been changed.