public void When()
 {
     _publishWithCorrelationId = Guid.NewGuid();
     _distibutionPointCorrelationId = Guid.NewGuid();
     _edp = new StreamEventReader(_bus, _distibutionPointCorrelationId, "stream", 10, new RealTimeProvider(), false);
     _edp.Resume();
     _firstEventId = Guid.NewGuid();
     _secondEventId = Guid.NewGuid();
     _edp.Handle(
         new ClientMessage.ReadStreamEventsForwardCompleted(
             _distibutionPointCorrelationId, "stream", 100, 100, ReadStreamResult.Success, 
             new[]
                 {
                     new ResolvedEvent(
                 new EventRecord(
                     10, 50, Guid.NewGuid(), _firstEventId, 50, 0, "stream", ExpectedVersion.Any, DateTime.UtcNow,
                     PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd,
                     "event_type1", new byte[] {1}, new byte[] {2}), null),
                     new ResolvedEvent(
                 new EventRecord(
                     11, 100, Guid.NewGuid(), _secondEventId, 100, 0, "stream", ExpectedVersion.Any,
                     DateTime.UtcNow,
                     PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd,
                     "event_type2", new byte[] {3}, new byte[] {4}), null)
                 }, "", 12, 11, true, 200));
     _edp.Pause();
     _edp.Handle(
         new ClientMessage.ReadStreamEventsForwardCompleted(
             _distibutionPointCorrelationId, "stream", 100, 100, ReadStreamResult.Success, 
             new ResolvedEvent[0], "", 12, 11, true, 400));
 }
 public new void When()
 {
     //_publishWithCorrelationId = Guid.NewGuid();
     _distibutionPointCorrelationId = Guid.NewGuid();
     _edp = new StreamEventReader(
         _bus, _distibutionPointCorrelationId, null, "stream", 0, new RealTimeProvider(), false);
 }
 public new void When()
 {
     _distibutionPointCorrelationId = Guid.NewGuid();
     _edp = new StreamEventReader(_bus, _distibutionPointCorrelationId, null, "stream", 10, new RealTimeProvider(), false,
         produceStreamDeletes: false);
     _edp.Resume();
 }
 public new void When()
 {
     //_publishWithCorrelationId = Guid.NewGuid();
     _distibutionPointCorrelationId = Guid.NewGuid();
     _fakeTimeProvider = new FakeTimeProvider();
     _edp = new StreamEventReader(
         _ioDispatcher, _bus, _distibutionPointCorrelationId, null, "stream", 10, _fakeTimeProvider,
         resolveLinkTos: false, stopOnEof: true, produceStreamDeletes: false);
     _edp.Resume();
     _firstEventId = Guid.NewGuid();
     _secondEventId = Guid.NewGuid();
     _edp.Handle(
         new ClientMessage.ReadStreamEventsForwardCompleted(
             _distibutionPointCorrelationId, "stream", 100, 100, ReadStreamResult.Success, 
             new[]
                 {
                     new ResolvedEvent(
                 new EventRecord(
                     10, 50, Guid.NewGuid(), _firstEventId, 50, 0, "stream", ExpectedVersion.Any, DateTime.UtcNow,
                     PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd,
                     "event_type1", new byte[] {1}, new byte[] {2}), null),
                     new ResolvedEvent(
                 new EventRecord(
                     11, 100, Guid.NewGuid(), _secondEventId, 100, 0, "stream", ExpectedVersion.Any,
                     DateTime.UtcNow,
                     PrepareFlags.SingleWrite | PrepareFlags.TransactionBegin | PrepareFlags.TransactionEnd,
                     "event_type2", new byte[] {3}, new byte[] {4}), null)
                 }, null, false, "", 12, 11, true, 200));
     _edp.Handle(
         new ClientMessage.ReadStreamEventsForwardCompleted(
             _distibutionPointCorrelationId, "stream", 100, 100, ReadStreamResult.Success, new ResolvedEvent[] { }, null, false, "", 12, 11, true, 400));
 }
 public new void When()
 {
     _distibutionPointCorrelationId = Guid.NewGuid();
     _edp = new StreamEventReader(
         _ioDispatcher, _bus, _distibutionPointCorrelationId, null, "stream", 10, new RealTimeProvider(), false);
     _edp.Resume();
 }
 public new void When()
 {
     //_publishWithCorrelationId = Guid.NewGuid();
     _distibutionPointCorrelationId = Guid.NewGuid();
     _edp = new StreamEventReader(
         _ioDispatcher, _bus, _distibutionPointCorrelationId, null, "stream", 0, new RealTimeProvider(), false,
         produceStreamDeletes: false);
 }
 public new void When()
 {
     _distibutionPointCorrelationId = Guid.NewGuid();
     _edp = new StreamEventReader(_bus, _distibutionPointCorrelationId, null, "stream", 0, new RealTimeProvider(), false,
         produceStreamDeletes: false);
     _edp.Resume();
     _edp.Handle(
         new ClientMessage.ReadStreamEventsForwardCompleted(
             _distibutionPointCorrelationId, "stream", 100, 100,
             ReadStreamResult.NoStream, new ResolvedEvent[0], null, false, "", -1, ExpectedVersion.NoStream, true, 200));
 }
        protected override void Given()
        {
            TicksAreHandledImmediately();

            _distibutionPointCorrelationId = Guid.NewGuid();
            _streamEventReader = new StreamEventReader(_bus, _distibutionPointCorrelationId, null, _streamId, 0, new RealTimeProvider(), false,
                produceStreamDeletes: false);
            _streamEventReader.Resume();
            _firstEventId = Guid.NewGuid();
            _secondEventId = Guid.NewGuid();
        }
Beispiel #9
0
        private IEventReader CreatePausedStreamEventReader(
            Guid eventReaderId, IODispatcher ioDispatcher, IPublisher publisher, CheckpointTag checkpointTag,
            string streamName, bool stopOnEof, int?stopAfterNEvents, bool resolveLinkTos, bool produceStreamDeletes)
        {
            var lastProcessedSequenceNumber = checkpointTag.Streams.Values.First();
            var fromSequenceNumber          = lastProcessedSequenceNumber + 1;
            var eventReader = new StreamEventReader(publisher, eventReaderId, _runAs, streamName, fromSequenceNumber, _timeProvider,
                                                    resolveLinkTos, produceStreamDeletes, stopOnEof);

            return(eventReader);
        }
 public void When()
 {
     _publishWithCorrelationId = Guid.NewGuid();
     _distibutionPointCorrelationId = Guid.NewGuid();
     _edp = new StreamEventReader(_bus, _distibutionPointCorrelationId, "stream", 0, new RealTimeProvider(), false);
     _edp.Resume();
     _firstEventId = Guid.NewGuid();
     _secondEventId = Guid.NewGuid();
     _edp.Handle(
         new ClientMessage.ReadStreamEventsForwardCompleted(
             _distibutionPointCorrelationId, "stream", 100, 100,
             ReadStreamResult.NoStream, new ResolvedEvent[0], "", -1, ExpectedVersion.NoStream, true, 200));
 }
 public void empty_event_reader_id_throws_argument_exception()
 {
     var edp = new StreamEventReader(_bus, Guid.Empty, "stream", 0, new RealTimeProvider(), false);
 }
 private IEventReader CreatePausedStreamEventReader(
     Guid eventReaderId, IPublisher publisher, CheckpointTag checkpointTag, string streamName, bool stopOnEof,
     int? stopAfterNEvents, bool resolveLinkTos)
 {
     var lastProcessedSequenceNumber = checkpointTag.Streams.Values.First();
     var fromSequenceNumber = lastProcessedSequenceNumber + 1;
     var eventReader = new StreamEventReader(
         publisher, eventReaderId, _runAs, streamName, fromSequenceNumber, _timeProvider, resolveLinkTos,
         stopOnEof, stopAfterNEvents);
     return eventReader;
 }
 private static EventReader CreatePausedStreamEventReader(
     Guid eventReaderId, IPublisher publisher, CheckpointTag checkpointTag, string streamName, bool stopOnEof,
     bool resolveLinkTos)
 {
     var lastProcessedSequenceNumber = checkpointTag.Streams.Values.First();
     var fromSequenceNumber = lastProcessedSequenceNumber + 1;
     var eventReader = new StreamEventReader(
         publisher, eventReaderId, streamName, fromSequenceNumber, new RealTimeProvider(), resolveLinkTos,
         stopOnEof);
     return eventReader;
 }
 public void negative_event_sequence_number_throws_argument_exception()
 {
     var edp = new StreamEventReader(_bus, Guid.NewGuid(), "", -1, new RealTimeProvider(), false);
 }
 public void empty_stream_name_throws_argument_exception()
 {
     var edp = new StreamEventReader(_bus, Guid.NewGuid(), "", 0, new RealTimeProvider(), false);
 }
 public void it_can_be_created()
 {
     var edp = new StreamEventReader(_bus, Guid.NewGuid(), "stream", 0, new RealTimeProvider(), false);
 }
 public void null_publisher_throws_argument_null_exception()
 {
     var edp = new StreamEventReader(null, Guid.NewGuid(), "stream", 0, new RealTimeProvider(), false);
 }