Ejemplo n.º 1
0
        public void Setup()
        {
            Assert.IsNull(server);
            if (!Directory.Exists(IntegrationSetup.BackupDir))
            {
                return;
            }
            Prepare(@"..\..\..\app\bin\Debug", "acceptance");

            Url = InitHelper.RandomPort();
            var result = InitHelper.InitService(Url).Result;

            server = result.Item1;
            Config = result.Item2;
            Configure("acceptance", Url.ToString());
        }
Ejemplo n.º 2
0
        public void Reconfigure_host()
        {
            var normal = clientConfig.BaseUrl;
            var broken = InitHelper.RandomPort();

            clientConfig         = clientConfig.Clone();
            clientConfig.BaseUrl = broken;
            clientConfig.AltUri  = broken + "," + normal;

            var init = InitHelper.InitService(broken, new Service.Config.Config {
                RootPath      = cleaner.RandomDir(),
                Environment   = "Development",
                InjectedFault = "Test error"
            }).Result;

            disposable.Add(init.Item1);

            var result = Run(new UpdateCommand());

            Assert.That(result, Is.EqualTo(UpdateResult.SilentOk).Or.EqualTo(UpdateResult.OK));
        }
        public void Setup()
        {
            Assert.IsNull(server);
            Directory.CreateDirectory("var");

            clientConfig.DiadokApiKey    = "Analit-988b9e85-1b8e-40a9-b6bd-543790d0a7ec";
            clientConfig.DiadokUrl       = "https://diadoc-api.kontur.ru";
            clientConfig.BaseUrl         = InitHelper.RandomPort();
            clientConfig.RootDir         = @"var\client";
            clientConfig.RequestInterval = 1.Second();
            clientConfig.InitDir();

            Consts.ScrollLoadTimeout = TimeSpan.Zero;
            LogManager.GetLog        = t => new Log4net(t);
            AppBootstrapper.InitUi(true);

            global::Test.Support.Setup.SessionFactory = DbHelper.ServerNHConfig("server");
            var result = InitHelper.InitService(clientConfig.BaseUrl).Result;

            server        = result.Item1;
            serviceConfig = result.Item2;

            var nhibernate = new Client.Config.NHibernate.NHibernate();

            AppBootstrapper.NHibernate = nhibernate;
            AppBootstrapper.NHibernate.Init("client");
            Factory       = nhibernate.Factory;
            Configuration = nhibernate.Configuration;

            if (IsServerStale())
            {
                FileHelper.InitDir(clientConfig.DbDir, BackupDir);
            }
            if (IsClientStale())
            {
                ImportData();
                DbHelper.CopyDb(BackupDir);
            }
            DbHelper.SeedDb();
        }