public async Task Without_suspend_commit_happens() { bool committed = false; using (var sut = new SuspendableProjection( Util.Projection(commit: () => committed = true))) { for (int i = 1; i < 5; i++) { await sut.Project(new Envelope(new AllStreamPosition(i), null)); } await sut.Commit(); } committed.ShouldBeTrue(); }
public async Task Only_first_messages_before_error_are_processed() { var expected = new AllStreamPosition(3); AllStreamPosition lastCheckpoint = AllStreamPosition.None; using (var sut = new SuspendableProjection( Util.Projection(m => { lastCheckpoint = m.Checkpoint; if (m.Checkpoint == expected) { throw new Exception("test"); } }))) { for (int i = 1; i < 5; i++) { await sut.Project(new Envelope(new AllStreamPosition(i), null)); } } lastCheckpoint.ShouldBe(expected); }