public void OnTestSetup() { Acquire(); AppHost = new AnalyzeAppHost(); AppHost.Init(); AppHost.Start(Config.ListeningOn); DbConnection = AppHost.Container.TryResolve <IDbConnectionFactory>().Open(); DbConnection.DropAndCreateTable <Analyze>(); //MockSiteVisitDatabase.DropAndCreateDummyDatabaseSchema(DbConnection); 10.Times(i => DbConnection.Insert(new Analyze { Id = i, Type = "Type" + i })); //IdGenerator = AppHost.Container.TryResolve<IDatabaseIdGenerator>(); //TestData = new DbHelper(DbConnection, IdGenerator); //LocationHelper = new LocationHelper(DbConnection, IdGenerator); //TimeSeriesHelper = new TimeSeriesHelper(DbConnection, IdGenerator); ServiceClient = new JsonServiceClient(Config.ListeningOn); }
public void Restart_AppHosts() { for (int i = 0; i < 100; i++) { var sw = Stopwatch.StartNew(); using (var appHost = new AnalyzeAppHost()) { appHost.Init(); var db = appHost.TryResolve <IDbConnectionFactory>().Open(); appHost.Start(Config.ListeningOn); db.Dispose(); } "starting #1 took {0}ms".Print(sw.ElapsedMilliseconds); } }
public void OnTestFixtureTearDown() { "Disposing Fixture: #{0}".Print(TestCount); if (AppHost != null) { AppHost.Stop(); AppHost.Dispose(); AppHost = null; } if (DbConnection != null) { DbConnection.Close(); DbConnection.Dispose(); DbConnection = null; } Release(); }