Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }