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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
void HandleRequest(ReadStreamRequest r) { var worker = Context.ActorOf(_workerProps); worker.Forward(r); }