protected IActorRef CreateWriter(IEventStoreWriter writer = null, ISerializer serializer = null, IActorRef dispatcher = null) { writer = writer ?? MockEventStore.SuccessfulWriter(); serializer = serializer ?? new MockSerializer(); dispatcher = dispatcher ?? CreateTestProbe(); var props = BufferedEventWriter.CreateProps(writer, serializer, dispatcher, new GlobalOptions()); return(Sys.ActorOf(props)); }
public void Writer_does_not_publish_to_event_stream() { var dispatcher = CreateTestProbe(); var writer = CreateWriter(writer: MockEventStore.SuccessfulWriter(), dispatcher: dispatcher); var request = CreatePersistenceRequest(); var probe = CreateTestProbe(); Sys.EventStream.Subscribe(probe, typeof(IPersistedEvent)); writer.Tell(request); probe.ExpectNoMsg(TimeSpan.FromMilliseconds(500)); }
public void Writer_tells_persistedevents_to_dispatcher_in_order() { var dispatcher = CreateTestProbe(); var writer = CreateWriter(writer: MockEventStore.SuccessfulWriter(), dispatcher: dispatcher); var request = new PersistenceRequest(new[] { new UnpersistedEvent("a", new SampleEvent3()), new UnpersistedEvent("a", new SampleEvent1()), new UnpersistedEvent("a", new SampleEvent2()) }); writer.Tell(request); dispatcher.ExpectMsg <IPersistedEvent <SampleEvent3> >(); dispatcher.ExpectMsg <IPersistedEvent <SampleEvent1> >(); dispatcher.ExpectMsg <IPersistedEvent <SampleEvent2> >(); dispatcher.ExpectNoMsg(50); }