Esempio n. 1
0
        public void LoadConfig_TestLoad()
        {
            File.WriteAllText(Config, "{ \"KEY1\": \"VALUE1\" }");
            var subject = ConfigStoreLoader.LoadConfig(Folder);

            Assert.NotEmpty(subject);
            Assert.Equal("VALUE1", subject["KEY1"]);

            Clean();
        }
Esempio n. 2
0
        public void LoadConfig_TestOverwrite()
        {
            var configValues = new { KEY1 = "VALUE1", KEY2 = "VALUE2" };
            var secretValues = new { KEY1 = "SECRET", KEY3 = "VALUE3" };

            File.WriteAllText(Config, JsonConvert.SerializeObject(configValues));
            File.WriteAllText(Secret, JsonConvert.SerializeObject(secretValues));

            var subject = ConfigStoreLoader.LoadConfig(Folder);

            Assert.Equal(3, subject.Count);
            Assert.Equal(secretValues.KEY1, subject["KEY1"]);
            Assert.Equal(configValues.KEY2, subject["KEY2"]);
            Assert.Equal(secretValues.KEY3, subject["KEY3"]);

            Clean();
        }
Esempio n. 3
0
 public ConfigService()
 {
     _config = ConfigStoreLoader.LoadConfig(GetFolder());
 }
Esempio n. 4
0
        public void LoadConfig_TestNoFile()
        {
            var subject = ConfigStoreLoader.LoadConfig(Folder);

            Assert.Empty(subject);
        }