public void Saving_GivenEventMappedToAggregateType_ThenShouldSetRavenCollectionName() { var customerId = Guid.NewGuid(); using (var eventStore = new RavenEventStore(_documentStore)) { Conventions.SetFindAggregateTypeForEventType( type => { if (type == typeof(CustomerSignedUp)) { return(typeof(Customer)); } return(typeof(EventStream)); }); var storedEvents = new IEvent[] { new CustomerSignedUp(customerId), new SubscribedToNewsletter("latest"), new SubscribedToNewsletter("top") }; eventStore.Save <Customer>(customerId.ToString(), 0, storedEvents); eventStore.Flush(); } using (var session = _documentStore.OpenSession()) { var eventStream = session.Load <EventStream>(customerId.ToString()); var entityName = session.Advanced.GetMetadataFor(eventStream)[Constants.RavenEntityName].ToString(); Assert.That(entityName, Is.EqualTo("Customers")); } }