GetMessagesByMappingId() public method

public GetMessagesByMappingId ( ulong mappingId ) : MessageStoreResult
mappingId ulong
return MessageStoreResult
        public void GettingMessagesWithCursorInbetweenOnElementRangeGetsAll()
        {
            var store = new ScaleoutStore(10);

            var message = new ScaleoutMessage();
            store.Add(new ScaleoutMapping((ulong)1, message));

            var result = store.GetMessagesByMappingId(2);
            Assert.Equal(0ul, result.FirstMessageId);
            Assert.Equal(0, result.Messages.Count);
        }
        public void GettingMessagesWithCursorInbetweenFragmentsGetsEverythingAfterwards()
        {
            var store = new ScaleoutStore(10, 5);

            var frag1Values = new[] { 1, 2, 3, 4, 5 };
            // Purposely missing '6' between the fragments
            var frag2Values = new[] { 7, 8, 9, 10, 11 };

            foreach (var v in frag1Values.Concat(frag2Values))
            {
                store.Add(new ScaleoutMapping((ulong)v, new ScaleoutMessage()));
            }

            var result = store.GetMessagesByMappingId(6);
            
            Assert.Equal(7ul, result.FirstMessageId);
            Assert.Equal(5, result.Messages.Count);
        }
        public void AssertMessagesWithCursorForRange(int[] values, ulong targetId, ulong firstId, int count)
        {
            var store = new ScaleoutStore(10);

            var message = new ScaleoutMessage();
            foreach (var v in values)
            {
                store.Add(new ScaleoutMapping((ulong)v, message));
            }

            var result = store.GetMessagesByMappingId(targetId);
            Assert.Equal(firstId, result.FirstMessageId);
            Assert.Equal(count, result.Messages.Count);
        }
        public void GettingMessagesWithSentinelCursorReturnsEverything()
        {
            var store = new ScaleoutStore(10);

            var message = new ScaleoutMessage();
            store.Add(new ScaleoutMapping((ulong)0, message));

            var result = store.GetMessagesByMappingId(UInt64.MaxValue);
            Assert.Equal(0ul, result.FirstMessageId);
            Assert.Equal(1, result.Messages.Count);
        }
        public void GettingMessagesWithCursorLowerThanMinReturnsAll()
        {
            var store = new ScaleoutStore(10);

            for (int i = 5; i < 10; i++)
            {
                var message = new ScaleoutMessage();
                store.Add(new ScaleoutMapping((ulong)i, message));
            }

            var result = store.GetMessagesByMappingId(4);
            Assert.Equal(0ul, result.FirstMessageId);
            Assert.Equal(5ul, store.MinMappingId);
            Assert.Equal(5, result.Messages.Count);
        }
        public void GettingMessagesWithCursorBiggerThanMaxReturnsNothingIfNewer()
        {
            var store = new ScaleoutStore(10);

            for (int i = 0; i < 5; i++)
            {
                var message = new ScaleoutMessage();
                store.Add(new ScaleoutMapping((ulong)i, message));
            }

            var result = store.GetMessagesByMappingId(6);
            Assert.Equal(0, result.Messages.Count);
        }