public void SetupDatabaseAndTestLoadingData() { using (var installationContext = new EntityDataContext()) { installationContext.Database.EnsureDeleted(); installationContext.Database.Migrate(); } var manager = new RepositoryManager(); manager.RegisterRepositories(); // Loading game configuration using (var context = manager.CreateNewConfigurationContext()) using (manager.UseContext(context)) { var gameConfiguraton = manager.GetRepository <GameConfiguration>().GetAll().FirstOrDefault(); Assert.That(gameConfiguraton, Is.Not.Null); // Testing loading of an account using (var accountContext = manager.CreateNewAccountContext(gameConfiguraton)) using (manager.UseContext(accountContext)) { var account1 = manager.GetRepository <Account, IAccountRepository <Account> >() .GetAccountByLoginName("test1", "test1"); Assert.That(account1, Is.Not.Null); Assert.That(account1.LoginName, Is.EqualTo("test1")); } } }