Beispiel #1
0
        internal static BamServer CreateServer(string rootDir = "")
        {
            BamServer     server = new BamServer(BamConf.Load());
            ConsoleLogger logger = CreateLogger();

            server.MainLogger = logger;
            if (string.IsNullOrEmpty(rootDir))
            {
                rootDir = ".\\Test_".RandomLetters(5);
            }
            server.ContentRoot            = rootDir;
            server.DefaultHostPrefix.Port = RandomNumber.Between(8081, 65535);
            server.SaveConf(true);
            _servers.Add(server);
            return(server);
        }
Beispiel #2
0
        public void GenerateDaoInConfShouldMatchServerSetting()
        {
            BamConf conf = BamConf.Load();

            conf.GenerateDao = false;
            conf.Save(true);
            Expect.IsFalse(conf.GenerateDao);
            BamServer server = new BamServer(conf);

            server.GenerateDao = true;
            conf = server.GetCurrentConf();
            Expect.IsTrue(conf.GenerateDao);
            server.SaveConf(true);
            conf = BamConf.Load(server.ContentRoot);
            Expect.IsTrue(conf.GenerateDao);
        }
Beispiel #3
0
        public void TemplateInitializerShouldBeCalled()
        {
            BamServer server = CreateServer("{0}_Content"._Format(MethodBase.GetCurrentMethod().Name));
            BamConf   conf   = new BamConf();

            conf.InitializeTemplates = true;
            server.SetConf(conf);
            server.SaveConf(true);
            TestTemplateInitializer testInitializer = new TestTemplateInitializer(server);

            server.TemplateInitializer = testInitializer;
            Expect.IsFalse(testInitializer.InitializeCalled);
            server.Start();
            Expect.IsTrue(testInitializer.InitializeCalled);
            server.Stop();
        }
Beispiel #4
0
        internal static BamServer CreateServer(string rootDir = "")
        {
            BamServer     server = new BamServer(BamConf.Load());
            ConsoleLogger logger = new ConsoleLogger();

            logger.AddDetails = false;
            logger.UseColors  = true;
            logger.StartLoggingThread();
            server.MainLogger = logger;
            if (string.IsNullOrEmpty(rootDir))
            {
                rootDir = ".\\Test_".RandomLetters(5);
            }
            server.ContentRoot = rootDir;
            server.SaveConf(true);
            _servers.Add(server);
            return(server);
        }