예제 #1
0
        public void GetValuesFromJson()
        {
            var res01 = _jsonFileConfig.GetValue("kumuluzee.name");
            var res02 = _jsonFileConfig.GetValue("kumuluzee.server.base-url");
            var res03 = _jsonFileConfig.GetValue("kumuluzee.env.name");
            var res04 = _jsonFileConfig.GetValue("kumuluzee.name.unexisting");

            Assert.AreEqual(res01, "test-service");
            Assert.AreEqual(res02, "http://localhost:9000");
            Assert.AreEqual(res03, "dev");
            Assert.IsNull(res04);
        }
예제 #2
0
        public void GetValuesFromXml()
        {
            var res01 = _xmlFileConfig.GetValue("kumuluzee.name");
            var res02 = _xmlFileConfig.GetValue("kumuluzee.server.http.port");
            var res03 = _xmlFileConfig.GetValue("kumuluzee.env.name");
            var res04 = _xmlFileConfig.GetValue("kumuluzee.env.unexisting");

            Assert.AreEqual(res01, "test-service");
            Assert.AreEqual(res02, "9000");
            Assert.AreEqual(res03, "dev");
            Assert.IsNull(res04);
        }
예제 #3
0
        public void GetValuesFromYaml()
        {
            var res01 = _yamlFileConfig.GetValue("kumuluzee.NAME");
            var res02 = _yamlFileConfig.GetValue("kumuluzee.config.namespace");
            var res03 = _yamlFileConfig.GetValue("kumuluzee.env.name");
            var res04 = _yamlFileConfig.GetValue("kumuluzee.discovery.ttl");
            var res05 = _yamlFileConfig.GetValue("kumuluzee.unexisting");

            Assert.AreEqual(res01, "test-service");
            Assert.AreEqual(res02, "");
            Assert.AreEqual(res03, "dev");
            Assert.AreEqual(res04, "100");
            Assert.IsNull(res05);
        }
        public void TestConfigSource()
        {
            var c = new ConfigSource("test", () => "test2");

            Assert.Equal("test", c.Key);
            Assert.Equal("test2", c.GetValue());
        }
        public void GetDotValue()
        {
            var res01 = config.GetValue("kumuluzee.name.dot");
            var res02 = config.GetValue("kumuluzee.server.http.port.dot");
            var res03 = config.GetValue("kumuluzee.name");

            Assert.AreEqual(res01, "test-service_dot");
            Assert.AreEqual(res02, "9000_dot");
            Assert.IsNull(res03);
        }