示例#1
0
        public void GetFromAdConfig()
        {
            var adConfig = AdConfig.GetInstance();

            List <AdConfigParameter> parameters = new List <AdConfigParameter>();
            AdConfigParameter        param1     = new AdConfigParameter();
            AdConfigParameter        param2     = new AdConfigParameter();
            AdConfigParameter        param3     = new AdConfigParameter();
            AdConfigParameter        param4     = new AdConfigParameter();

            param1.key   = "stringKey";
            param1.value = "string";
            parameters.Add(param1);
            param2.key   = "intKey";
            param2.value = "6000";
            parameters.Add(param2);
            param3.key   = "boolKey";
            param3.value = "true";
            parameters.Add(param3);
            param4.key   = "longKey";
            param4.value = "60000000";
            parameters.Add(param4);

            adConfig.parameters = parameters;

            adConfig.Init(adConfig);

            Assert.That(adConfig.Get("stringKey", "key"), Is.EqualTo("string"));
            Assert.That(adConfig.GetInt("intKey", 0), Is.EqualTo(6000));
            Assert.That(adConfig.GetBool("boolKey", false), Is.EqualTo(true));
            Assert.That(adConfig.GetLong("longKey", 0), Is.EqualTo(60000000));

            Assert.That(adConfig.Get("intKey", "key"), Is.EqualTo("6000"));
            Assert.That(adConfig.GetInt("stringKey", 0), Is.EqualTo(0));
            Assert.That(adConfig.GetBool("longKey", false), Is.EqualTo(false));
            Assert.That(adConfig.GetLong("boolKey", 0), Is.EqualTo(0));
        }