Exemple #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);
        }
Exemple #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);
            }
        }