public async Task Aggregates_Multiple_Streams_In_Order() { var store = new FileSystemEventStore(EventPath); DeleteEvents(); var eventsReceived = new List <IEvent>(); store.EventHandler = e => { eventsReceived.Add(e); return(Task.CompletedTask); }; // Raise some events await store.RaiseEventAsync(new TestEvent("Hello, World!")); await store.RaiseEventAsync(new AnotherTestEvent("Hello, Bob!")); await store.RaiseEventAsync(new TestEvent("Hello, Dave!")); // Pretend we haven't seen them yet eventsReceived.Clear(); // Replay and check they are correct await store.ReplayAllEvents(); eventsReceived[0].Stream.ShouldBe("test-stream"); ((TestEvent)eventsReceived[0]).TestValue.ShouldBe("Hello, World!"); eventsReceived[1].Stream.ShouldBe("another-test-stream"); ((AnotherTestEvent)eventsReceived[1]).TestValue.ShouldBe("Hello, Bob!"); eventsReceived[2].Stream.ShouldBe("test-stream"); ((TestEvent)eventsReceived[2]).TestValue.ShouldBe("Hello, Dave!"); }
public async Task Does_Not_Throw_Replaying_No_Events() { var store = new FileSystemEventStore(EventPath); DeleteEvents(); await store.ReplayAllEvents(); }