public void produced_checkpoint_tags_are_correctly_ordered() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); var zero = t.MakeZeroCheckpointTag(); var zeroEvent = t.MakeCheckpointTag(zero, _zeroEvent); var zeroEvent2 = t.MakeCheckpointTag(zeroEvent, _zeroEvent); var first = t.MakeCheckpointTag(zeroEvent2, _firstEvent); var second = t.MakeCheckpointTag(first, _secondEvent); var second2 = t.MakeCheckpointTag(zeroEvent, _secondEvent); var third = t.MakeCheckpointTag(second, _thirdEvent); Assert.IsTrue(zeroEvent > zero); Assert.IsTrue(first > zero); Assert.IsTrue(second > first); Assert.AreEqual(zeroEvent2, zeroEvent); Assert.AreNotEqual(second, second2); Assert.IsTrue(second2 > zeroEvent); Assert.Throws <InvalidOperationException>(() => TestHelper.Consume(second2 > first)); Assert.IsTrue(third > second); Assert.IsTrue(third > first); Assert.IsTrue(third > zeroEvent); Assert.IsTrue(third > zero); }
public void When() { _tagger = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); _positionTracker = new PositionTracker(_tagger); // when _positionTracker.UpdateByCheckpointTagInitial(_tagger.MakeZeroCheckpointTag()); }
public void zero_position_tag_is_before_first_event_possible() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); var zero = t.MakeZeroCheckpointTag(); var zeroFromEvent = t.MakeCheckpointTag(zero, _zeroEvent); Assert.IsTrue(zeroFromEvent > zero); }
public void adjust_compatible_tag_returns_the_same_tag() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); var tag = CheckpointTag.FromStreamPositions(0, new Dictionary <string, int> { { "stream1", 1 }, { "stream2", 2 } }); Assert.AreEqual(tag, t.AdjustTag(tag)); }
public void is_message_after_checkpoint_tag_incompatible_streams_case() { var t = new MultiStreamPositionTagger(new[] { "stream-other", "stream2" }); var result = t.IsMessageAfterCheckpointTag(CheckpointTag.FromStreamPositions(new Dictionary <string, int> { { "stream-other", 0 }, { "stream2", 0 } }), _firstEvent); Assert.IsFalse(result); }
public void can_adjust_stream_position_tag() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); var tag = CheckpointTag.FromStreamPositions(0, new Dictionary <string, int> { { "stream1", 1 }, { "stream2", -1 } }); var original = CheckpointTag.FromStreamPosition(0, "stream1", 1); Assert.AreEqual(tag, t.AdjustTag(original)); }
public void the_same_stream_checkpoint_tag_is_compatible() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); Assert.IsTrue( t.IsCompatible( CheckpointTag.FromStreamPositions(0, new Dictionary <string, int> { { "stream1", 100 }, { "stream2", 150 } }))); }
public void another_streams_checkpoint_tag_is_incompatible() { var t = new MultiStreamPositionTagger(new[] { "stream1", "stream2" }); Assert.IsFalse( t.IsCompatible( CheckpointTag.FromStreamPositions(new Dictionary <string, int> { { "stream2", 100 }, { "stream3", 150 } }))); }
public void is_message_after_checkpoint_tag_equal_case() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); var result = t.IsMessageAfterCheckpointTag( CheckpointTag.FromStreamPositions(0, new Dictionary <string, int> { { "stream1", 1 }, { "stream2", 1 } }), _firstEvent); Assert.IsFalse(result); }
public void When() { // given _tagger = new MultiStreamPositionTagger(0, new [] { "stream1", "stream2" }); _positionTracker = new PositionTracker(_tagger); var newTag = CheckpointTag.FromStreamPositions(0, new Dictionary <string, long> { { "stream1", 1 }, { "stream2", 2 } }); var newTag2 = CheckpointTag.FromStreamPositions(0, new Dictionary <string, long> { { "stream1", 1 }, { "stream2", 3 } }); _positionTracker.UpdateByCheckpointTagInitial(newTag); _positionTracker.UpdateByCheckpointTagForward(newTag2); }
public void When() { // given var tagger = new MultiStreamPositionTagger(0, new [] { "stream1", "stream2" }); var tracker = new PositionTracker(tagger); var newTag = CheckpointTag.FromStreamPositions(0, new Dictionary <string, long> { { "stream1", 1 }, { "stream2", 2 } }); tracker.UpdateByCheckpointTagInitial(newTag); _tag = tracker.LastTag; _tagger = new MultiStreamPositionTagger(0, new [] { "stream1", "stream2" }); _positionTracker = new PositionTracker(_tagger); // when _positionTracker.UpdateByCheckpointTagInitial(_tag); }
public void when() { _tagger = new MultiStreamPositionTagger(0, new [] { "stream1", "stream2" }); _positionTracker = new PositionTracker(_tagger); }
public void can_be_created() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); new PositionTracker(t); }
public void position_checkpoint_tag_is_incompatible() { var t = new MultiStreamPositionTagger(0, new[] { "stream1", "stream2" }); Assert.IsFalse(t.IsCompatible(CheckpointTag.FromPosition(0, 1000, 500))); }
public void empty_streams_throws_argument_exception() { var t = new MultiStreamPositionTagger(new string[] {}); }
public void null_streams_throws_argument_null_exception() { var t = new MultiStreamPositionTagger(null); }