コード例 #1
0
        public void Reads_with_sequence_above_highest_sends_ReadFinished()
        {
            var reader = CreateReader();

            var req = new ReadStreamRequest("b", 1000, EventCount.Unlimited);
            reader.Tell(req);
            ExpectMsg<ReadStreamFinished>(m => m.RequestID == req.RequestID);
        }
コード例 #2
0
        public void ReadStreamRequests_are_forwarded_to_worker()
        {
            var o = new TestContainer(this);

            var req = new ReadStreamRequest("a", 1, 1);
            o.Reader.Tell(req);

            o.ReadStreamProbe.ExpectMsg<ReadStreamRequest>(m => m == req);
        }
コード例 #3
0
        public void Reads_single_event(string streamName, int sequenceToRead)
        {
            var reader = CreateReader();

            var req = new ReadStreamRequest(streamName, sequenceToRead, 1);
            reader.Tell(req);

            ExpectMsg<ReadStreamResponse>(m => m.RequestID == req.RequestID && m.Event.Stream.Equals(streamName) && m.Event.StreamSequence == sequenceToRead);
            ExpectMsg<ReadStreamFinished>(m => m.RequestID == req.RequestID);
        }
コード例 #4
0
        public void Reads_all_events(string streamName, int eventCount)
        {
            var reader = CreateReader();

            var req = new ReadStreamRequest(streamName, 1, EventCount.Unlimited);
            reader.Tell(req);

            for (int i = 1; i <= eventCount; i++)
                ExpectMsg<ReadStreamResponse>(m => m.RequestID == req.RequestID && m.Event.StreamSequence == i);

            ExpectMsg<ReadStreamFinished>(m => m.RequestID == req.RequestID);
        }
コード例 #5
0
        public void Reads_with_initialsequence_and_counts()
        {
            var reader = CreateReader();

            var req = new ReadStreamRequest("c", 7, 3);
            reader.Tell(req);

            ExpectMsg<ReadStreamResponse>(m => m.RequestID == req.RequestID && m.Event.StreamSequence == 7);
            ExpectMsg<ReadStreamResponse>(m => m.RequestID == req.RequestID && m.Event.StreamSequence == 8);
            ExpectMsg<ReadStreamResponse>(m => m.RequestID == req.RequestID && m.Event.StreamSequence == 9);
            ExpectMsg<ReadStreamFinished>(m => m.RequestID == req.RequestID);
        }
コード例 #6
0
        public void Reads_with_count_zero_sends_ReadFinished()
        {
            var reader = CreateReader();

            var req = new ReadStreamRequest("c", 1, 0);

            reader.Tell(req);
            ExpectMsg<ReadStreamFinished>(m => m.RequestID == req.RequestID);
        }
コード例 #7
0
        public void Receives_ReadAborted_on_store_exception()
        {
            var ex = new Exception();
            var store = MockEventStore.ThrowsOnReadStreams(ex);
            var factory = Substitute.For<IPersistedEventFactory>();

            var props = Props.Create<ReadStreamWorker>(store, factory);
            var actor = Sys.ActorOf(props);

            var req = new ReadStreamRequest("a", 1, EventCount.Unlimited);
            actor.Tell(req);
            ExpectMsg<Aborted>(m => m.RequestID == req.RequestID && m.Exception == ex);
        }
コード例 #8
0
        public void Receives_ReadCancelled_on_cancel_request()
        {
            var reader = CreateReader();

            var req = new ReadStreamRequest("a", 1, EventCount.Unlimited);
            reader.Tell(req);
            reader.Tell(new CancelRequest(req.RequestID));

            ExpectMsgEventually<Cancelled>(m => m.RequestID == req.RequestID);
        }
コード例 #9
0
ファイル: StreamEventReader.cs プロジェクト: promontis/Even
 void HandleRequest(ReadStreamRequest r)
 {
     var worker = Context.ActorOf(_workerProps);
     worker.Forward(r);
 }