public void should_read_only_events_backward_with_event_type_regex()
        {
            var filter = new TcpClientMessageDto.Filter(
                FilterContext.EventType,
                FilterType.Regex, new[] { @"^.*other-event.*$" });
            var eventFilter = EventFilter.Get(filter);

            var result = ReadIndex.ReadAllEventsBackwardFiltered(_backwardReadPos, 10, 10, eventFilter);

            Assert.AreEqual(2, result.Records.Count);
        }
        public void should_read_only_events_backward_with_stream_id_prefix()
        {
            var filter = new TcpClientMessageDto.Filter(
                FilterContext.StreamId,
                FilterType.Prefix, new[] { "ES2" });
            var eventFilter = EventFilter.Get(filter);

            var result = ReadIndex.ReadAllEventsBackwardFiltered(_backwardReadPos, 10, 10, eventFilter);

            Assert.AreEqual(1, result.Records.Count);
        }
示例#3
0
        public void should_read_only_events_backward_with_event_type_prefix()
        {
            var filter = new Filter(
                Filter.Types.FilterContext.EventType,
                Filter.Types.FilterType.Prefix, new[] { "event-type" });
            var eventFilter = EventFilter.Get(true, filter);

            var result = ReadIndex.ReadAllEventsBackwardFiltered(_backwardReadPos, 10, 10, eventFilter);

            Assert.AreEqual(2, result.Records.Count);
        }
示例#4
0
        public void should_read_only_events_backward_with_stream_id_regex()
        {
            var filter = new Filter(
                Filter.Types.FilterContext.StreamId,
                Filter.Types.FilterType.Regex, new[] { @"^.*ES2.*$" });
            var eventFilter = EventFilter.Get(true, filter);

            var result = ReadIndex.ReadAllEventsBackwardFiltered(_backwardReadPos, 10, 10, eventFilter);

            Assert.AreEqual(1, result.Records.Count);
        }
        public void should_filter_out_disallowed_streams_when_reading_events_backward_with_stream_id_regex()
        {
            var filter = new Filter(
                Filter.Types.FilterContext.StreamId,
                Filter.Types.FilterType.Regex, new[] { @"^.*istentsubsc.*$" });
            var eventFilter = EventFilter.Get(true, filter);

            var result = ReadIndex.ReadAllEventsBackwardFiltered(_backwardReadPos, 10, 10, eventFilter);

            Assert.AreEqual(1, result.Records.Count);
            Assert.True(result.Records.All(x => x.Event.EventStreamId != _disallowedStream));
            Assert.True(result.Records.Any(x => x.Event.EventStreamId == _allowedStream2));
        }
        public void should_filter_out_disallowed_streams_when_reading_events_backward_with_stream_id_prefix()
        {
            var filter = new TcpClientMessageDto.Filter(
                FilterContext.StreamId,
                FilterType.Prefix, new[] { "$persistentsubscripti" });
            var eventFilter = EventFilter.Get(true, filter);

            var result = ReadIndex.ReadAllEventsBackwardFiltered(_backwardReadPos, 10, 10, eventFilter);

            Assert.AreEqual(1, result.Records.Count);
            Assert.True(result.Records.All(x => x.Event.EventStreamId != _disallowedStream));
            Assert.True(result.Records.Any(x => x.Event.EventStreamId == _allowedStream2));
        }
        public void should_filter_out_disallowed_streams_when_reading_events_backward_with_event_type_prefix()
        {
            var filter = new Filter(
                Filter.Types.FilterContext.EventType,
                Filter.Types.FilterType.Prefix, new[] { "event-type" });
            var eventFilter = EventFilter.Get(true, filter);

            var result = ReadIndex.ReadAllEventsBackwardFiltered(_backwardReadPos, 10, 10, eventFilter);

            Assert.AreEqual(2, result.Records.Count);
            Assert.True(result.Records.All(x => x.Event.EventStreamId != _disallowedStream));
            Assert.True(result.Records.Any(x => x.Event.EventStreamId == _allowedStream1));
            Assert.True(result.Records.Any(x => x.Event.EventStreamId == _allowedStream2));
        }