示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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();
        }