Beispiel #1
0
        public void get()
        {
            theDictionary.Add("a", 1);
            theDictionary.Add("b", 2);

            theSource.Get("a").ShouldEqual(1);
            theSource.Get("b").ShouldEqual(2);
        }
        public void read_text()
        {
            var data = new SettingsData(SettingCategory.core);
            data.Read("Key=Value1");
            data.Read("A.Key=Value2");

            data.AllKeys.ShouldHaveTheSameElementsAs("Key", "A.Key");

            data.Get("Key").ShouldEqual("Value1");
            data.Get("A.Key").ShouldEqual("Value2");
        }
        public void read_complex_escaped_value()
        {
            var data = new SettingsData(SettingCategory.core);
            data.Read("DatabaseSettings.ConnectionString=\"Data Source=localhost;Initial Catalog=DovetailDAI;User Id=sa;Password=sa;\"");

            data.AllKeys.ShouldHaveTheSameElementsAs("DatabaseSettings.ConnectionString");

            data.Get("DatabaseSettings.ConnectionString").ShouldEqual("Data Source=localhost;Initial Catalog=DovetailDAI;User Id=sa;Password=sa;");
        }
Beispiel #4
0
        public void load_several_levels_of_nested_properties()
        {
            var source = new SettingsData(new Dictionary <string, object>(), "some name");

            source["A"]              = 1;
            source["B"]              = 2;
            source["Child.A"]        = 2;
            source["Child.B"]        = 3;
            source["Child.Nested.A"] = 4;
            source["Child.Nested.B"] = 5;

            source.Get("A").ShouldEqual(1);
            source.Get("B").ShouldEqual(2);
            source.As <IValueSource>().GetChild("Child").Get("A").ShouldEqual(2);
            source.As <IValueSource>().GetChild("Child").Get("B").ShouldEqual(3);
            source.As <IValueSource>().GetChild("Child").GetChild("Nested").Get("A").ShouldEqual(4);
            source.As <IValueSource>().GetChild("Child").GetChild("Nested").Get("B").ShouldEqual(5);
        }
Beispiel #5
0
 public void get_value()
 {
     theSettings.Get("WebsiteSettings.DiagnosticsEnabled").ShouldEqual("true");
 }