public void can_get_by_category() { foreach (var repo in _repos) { var r = repo as MockEventStoreRepository; if (r == null) { continue; } var q = new TestQueue(); r.Subscribe(q); var id1 = Guid.NewGuid(); var tAgg = new TestAggregate(id1); tAgg.RaiseBy(1); tAgg.RaiseBy(2); tAgg.RaiseBy(3); repo.Save(tAgg, Guid.NewGuid(), h => { }); var id3 = Guid.NewGuid(); var tAgg3 = new TestWoftamAggregate(id3); tAgg3.ProduceEvents(3); repo.Save(tAgg3, Guid.NewGuid(), h => { }); var id2 = Guid.NewGuid(); var tAgg2 = new TestAggregate(id2); tAgg2.RaiseBy(4); tAgg2.RaiseBy(5); tAgg2.RaiseBy(6); repo.Save(tAgg2, Guid.NewGuid(), h => { }); Assert.Equal(12, q.Messages.Count); var bus = new InMemoryBus("all"); var q2 = new TestQueue(bus); r.ReplayCategoryOnto(bus, "testAggregate"); q2.Messages .AssertNext <TestAggregateMessages.NewAggregate>( correlationId: id1) .AssertNext <TestAggregateMessages.Increment>( m => m.Amount == 1, "Event mismatch wrong amount") .AssertNext <TestAggregateMessages.Increment>( m => m.Amount == 2, "Event mismatch wrong amount") .AssertNext <TestAggregateMessages.Increment>( m => m.Amount == 3, "Event mismatch wrong amount") .AssertNext <TestAggregateMessages.NewAggregate>( correlationId: id2) .AssertNext <TestAggregateMessages.Increment>( m => m.Amount == 4, "Event mismatch wrong amount") .AssertNext <TestAggregateMessages.Increment>( m => m.Amount == 5, "Event mismatch wrong amount") .AssertNext <TestAggregateMessages.Increment>( m => m.Amount == 6, "Event mismatch wrong amount") .AssertEmpty(); r.ReplayCategoryOnto(bus, "testWoftamAggregate"); q2.Messages .AssertNext <TestWoftamAggregateCreated>( correlationId: id3) .AssertNext <WoftamEvent>( correlationId: Guid.Empty) .AssertNext <WoftamEvent>( correlationId: Guid.Empty) .AssertNext <WoftamEvent>( correlationId: Guid.Empty) .AssertEmpty(); } }