Ejemplo n.º 1
0
        public void TestApollo()
        {
            var provider = new HttpConfigProvider
            {
                Server = _server,
                AppId  = "testapi"
            };

            provider.SetApollo("application");
            //provider.LoadAll();

            var url = provider["appapiurl"];

            Assert.NotEmpty(url);

            var keys = provider.Keys.ToArray();

            Assert.NotNull(keys);

            var model = provider.Load <Model>();

            Assert.NotNull(model);
            Assert.NotEmpty(model.AppApiUrl);
            Assert.Equal(url, model.AppApiUrl);
            Assert.True(model.Radius > 0);
            Assert.NotEmpty(model.MySqlServer);

            var model2 = new Model();

            provider.Bind(model2);
            Assert.Equal(url, model2.AppApiUrl);
            Assert.True(model2.Radius > 0);
            Assert.NotEmpty(model2.MySqlServer);
        }
Ejemplo n.º 2
0
        public void TestStardust()
        {
            var provider = new HttpConfigProvider
            {
                Server = "http://star.newlifex.com:6600",
                AppId  = "StarWeb"
            };

            var str = provider["test1"];

            Assert.NotEmpty(str);

            var keys = provider.Keys.ToArray();

            Assert.NotNull(keys);

            var model = provider.Load <Model2>();

            Assert.NotNull(model);
            Assert.NotEmpty(model.Test);
            Assert.Equal(str, model.Test);
            Assert.NotEmpty(model.Shop);
            Assert.NotEmpty(model.Title);
            Assert.Equal("NewLife开发团队", model.Title);

            var model2 = new Model2();

            provider.Bind(model2);
            Assert.Equal(str, model2.Test);
            Assert.NotEmpty(model.Shop);
            Assert.Equal("NewLife开发团队", model.Title);
        }
Ejemplo n.º 3
0
        public void TestStardust()
        {
            var set = new ConfigModel
            {
                Debug      = true,
                LogLevel   = LogLevel.Fatal,
                LogPath    = "xxx",
                NetworkLog = "255.255.255.255:514",
                TempPath   = "yyy",

                Sys = new SysConfig
                {
                    Name        = "NewLife.Cube",
                    DisplayName = "魔方平台",
                    Company     = "新生命开发团队",
                },
            };

            var provider = new HttpConfigProvider
            {
                Server = "http://star.newlifex.com:6600",
                //Server = "http://localhost:6600",
                AppId = "Test"
            };

            provider.Save(set);

            provider.Save(new Model2 {
                Test = "测试", Shop = "商店", Title = "NewLife开发团队"
            });


            var str = provider["test1"];

            Assert.NotEmpty(str);

            var keys = provider.Keys.ToArray();

            Assert.NotNull(keys);

            var model = provider.Load <Model2>();

            Assert.NotNull(model);
            Assert.NotEmpty(model.Test);
            Assert.Equal(str, model.Test);
            Assert.NotEmpty(model.Shop);
            Assert.NotEmpty(model.Title);
            Assert.Equal("NewLife开发团队", model.Title);

            var model2 = new Model2();

            provider.Bind(model2);
            Assert.Equal(str, model2.Test);
            Assert.NotEmpty(model.Shop);
            Assert.Equal("NewLife开发团队", model.Title);

            provider.LoadAll();
        }