public async Task Replays_All_Events_In_Order() { var store = new SqlServerEventStore(_conStr); DeleteEventsTable(); 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 TestEvent("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("test-stream"); ((TestEvent)eventsReceived[1]).TestValue.ShouldBe("Hello, Bob!"); eventsReceived[2].Stream.ShouldBe("test-stream"); ((TestEvent)eventsReceived[2]).TestValue.ShouldBe("Hello, Dave!"); }