protected Test(TestFixture fixture) { // Init Browser this.Driver = fixture.Driver; // Init Server this.Driver.Navigate().GoToUrl(Test.DatabaseInitUrl); // Init Allors CultureInfo.CurrentCulture = new CultureInfo("nl-BE"); CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture; const string FileName = @"apps.appSettings.json"; var userSettings = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}/allors/{FileName}"; var systemSettings = $@"{Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)}/allors/{FileName}"; var appConfiguration = new ConfigurationBuilder() .AddJsonFile(@"appSettings.json") .AddJsonFile(systemSettings, true) .AddJsonFile(userSettings, true) .AddEnvironmentVariables() .Build(); var objectFactory = new ObjectFactory(MetaPopulation.Instance, typeof(User)); var services = new ServiceCollection(); services.AddAllors(); var serviceProvider = services.BuildServiceProvider(); var configuration = new Configuration { ConnectionString = appConfiguration["ConnectionStrings:DefaultConnection"], ObjectFactory = objectFactory, }; var database = new Database(serviceProvider, configuration); if (population == null && populationFileInfo.Exists) { population = File.ReadAllText(populationFileInfo.FullName); } if (population != null) { using (var stringReader = new StringReader(population)) using (var reader = XmlReader.Create(stringReader)) { database.Load(reader); } } else { database.Init(); using (var session = database.CreateSession()) { new Setup(session, null).Apply(); session.Commit(); new Population(session, null).Execute(); session.Commit(); using (var stringWriter = new StringWriter()) { using (var writer = XmlWriter.Create(stringWriter)) { database.Save(writer); } population = stringWriter.ToString(); File.WriteAllText(populationFileInfo.FullName, population); } } } this.Session = database.CreateSession(); }