Esempio n. 1
0
 public void subset_by_prefix_copies_category()
 {
     var data = new SettingsData(SettingCategory.package);
     data.SubsetPrefixedBy("a").Category.ShouldEqual(data.Category);
 }
Esempio n. 2
0
        public void subset_by_prefix_copies_provenance()
        {
            var data = new SettingsData(SettingCategory.core){
                Provenance = Guid.NewGuid().ToString()
            };

            data.SubsetPrefixedBy("a").Provenance.ShouldEqual(data.Provenance);
        }
Esempio n. 3
0
        public void subset_by_prefix()
        {
            var data = new SettingsData(SettingCategory.core);
            data.With("One.A", "1");
            data.With("One.B", "2");
            data.With("One.C", "1");
            data.With("Two.A", "11");
            data.With("Two.B", "12");
            data.With("Two.C", "13");
            data.With("Two.D", "14");
            data.With("Three.A", "21");
            data.With("Three.B", "22");
            data.With("Three.C", "23");

            var subsetOne = data.SubsetPrefixedBy("One.");
            subsetOne.AllKeys.ShouldHaveTheSameElementsAs("A", "B", "C");
            subsetOne.Get("A").ShouldEqual("1");

            var subsetTwo = data.SubsetPrefixedBy("Two.");
            subsetTwo.AllKeys.ShouldHaveTheSameElementsAs("A", "B", "C", "D");
            subsetTwo.Get("A").ShouldEqual("11");

            var subsetThree = data.SubsetPrefixedBy("Three.");
            subsetThree.AllKeys.ShouldHaveTheSameElementsAs("A", "B", "C");
            subsetThree.Get("A").ShouldEqual("21");
        }