public void every_prepare_can_be_commited() { var res = ReadIndex.CheckCommitStartingAt(_prepare0.LogPosition, WriterCheckpoint.ReadNonFlushed()); Assert.AreEqual(CommitDecision.Ok, res.Decision); Assert.AreEqual("ES", res.EventStreamId); Assert.AreEqual(-1, res.CurrentVersion); Assert.AreEqual(-1, res.StartEventNumber); Assert.AreEqual(-1, res.EndEventNumber); res = ReadIndex.CheckCommitStartingAt(_prepare1.LogPosition, WriterCheckpoint.ReadNonFlushed()); Assert.AreEqual(CommitDecision.Ok, res.Decision); Assert.AreEqual("ES", res.EventStreamId); Assert.AreEqual(-1, res.CurrentVersion); Assert.AreEqual(-1, res.StartEventNumber); Assert.AreEqual(-1, res.EndEventNumber); res = ReadIndex.CheckCommitStartingAt(_prepare2.LogPosition, WriterCheckpoint.ReadNonFlushed()); Assert.AreEqual(CommitDecision.Ok, res.Decision); Assert.AreEqual("ES", res.EventStreamId); Assert.AreEqual(-1, res.CurrentVersion); Assert.AreEqual(-1, res.StartEventNumber); Assert.AreEqual(-1, res.EndEventNumber); }
public void check_commmit_on_2nd_prepare_should_return_ok_decision() { var res = ReadIndex.CheckCommitStartingAt(_prepare1.LogPosition, WriterCheckpoint.ReadNonFlushed()); Assert.AreEqual(CommitDecision.Ok, res.Decision); Assert.AreEqual("ES", res.EventStreamId); Assert.AreEqual(0, res.CurrentVersion); Assert.AreEqual(-1, res.StartEventNumber); Assert.AreEqual(-1, res.EndEventNumber); }
public void check_commmit_on_not_expected_prepare_should_return_wrong_expected_version() { var res = ReadIndex.CheckCommitStartingAt(_prepare4.LogPosition, WriterCheckpoint.ReadNonFlushed()); Assert.AreEqual(CommitDecision.WrongExpectedVersion, res.Decision); Assert.AreEqual("ES", res.EventStreamId); Assert.AreEqual(2, res.CurrentVersion); Assert.AreEqual(-1, res.StartEventNumber); Assert.AreEqual(-1, res.EndEventNumber); }
public void other_prepares_cannot_be_committed() { var res = ReadIndex.CheckCommitStartingAt(_prepare0.LogPosition, WriterCheckpoint.ReadNonFlushed()); Assert.AreEqual(CommitDecision.WrongExpectedVersion, res.Decision); Assert.AreEqual("ES", res.EventStreamId); Assert.AreEqual(0, res.CurrentVersion); Assert.AreEqual(-1, res.StartEventNumber); Assert.AreEqual(-1, res.EndEventNumber); res = ReadIndex.CheckCommitStartingAt(_prepare2.LogPosition, WriterCheckpoint.ReadNonFlushed()); Assert.AreEqual(CommitDecision.WrongExpectedVersion, res.Decision); Assert.AreEqual("ES", res.EventStreamId); Assert.AreEqual(0, res.CurrentVersion); Assert.AreEqual(-1, res.StartEventNumber); Assert.AreEqual(-1, res.EndEventNumber); }