private void ValidateEagerLoadingWithColdCache(PersistenceContextProvider persistenceContextProvider) { using (persistenceContextProvider) { using (var context = persistenceContextProvider.CreateContext()) { var account = context.GetAll <Account>().First(); Assert.IsNotNull(account.Characters[0].CurrentMap.Name); } } }
private void ValidatePersistenceCache(PersistenceContextProvider persistenceContextProvider) { using (persistenceContextProvider) { var dataInitializer = new PersistenceInitializer(persistenceContextProvider); dataInitializer.CreateConfiguration(); dataInitializer.CreateTestData(); GameConfiguration config1 = null; using (var context = persistenceContextProvider.CreateContext()) { config1 = context.GetAll <GameConfiguration>().First(); } GameConfiguration config2 = null; using (var context = persistenceContextProvider.CreateContext()) { config2 = context.GetAll <GameConfiguration>().First(); } // These references should be the same (fetched from the configuration cache) Assert.AreSame(config1.MapDefinitions[0].Name, config2.MapDefinitions[0].Name); } }