public void A_hundred_thousand_events_large_aggregate_with_four_migrations_should_load_cached_in_less_than_150_milliseconds()
{
var eventMigrations = Seq.Create<IEventMigration>(
Before<E6>.Insert<E2>(),
Before<E7>.Insert<E3>(),
Before<E8>.Insert<E4>(),
Before<E9>.Insert<E5>()
).ToArray();
using(var container = CreateContainerForEventStoreType(() => eventMigrations, EventStoreType))
{
var timeSource = container.Resolve<DummyTimeSource>();
var history = Seq.OfTypes<Ec1>().Concat(1.Through(100000).Select(index => typeof(E1))).ToArray();
var aggregate = TestAggregate.FromEvents(timeSource, Guid.NewGuid(), history);
container.ExecuteUnitOfWorkInIsolatedScope(() => container.Resolve<IEventStoreSession>().Save(aggregate));
//Warm up cache..
container.ExecuteUnitOfWorkInIsolatedScope(() => container.Resolve<IEventStoreSession>().Get<TestAggregate>(aggregate.Id));
TimeAsserter.Execute(
maxTotal: 150.Milliseconds().AdjustRuntimeForNCrunch(boost: 6),
description: "load aggregate in isolated scope",
action: () => container.ExecuteInIsolatedScope(() => container.Resolve<IEventStoreSession>().Get<TestAggregate>(aggregate.Id)));
}
}
}