示例#1
0
        public void subset_by_filter_copies_provenance()
        {
            var data = new SettingsData(SettingCategory.core){
                Provenance = Guid.NewGuid().ToString()
            };

            data.SubsetByKey(key => true).Provenance.ShouldEqual(data.Provenance);
        }
示例#2
0
        public void subset_by_key_filter()
        {
            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 subsetA = data.SubsetByKey(key => key.Contains("A"));
            subsetA.AllKeys.ShouldHaveTheSameElementsAs("One.A", "Two.A", "Three.A");
            subsetA.Get("One.A").ShouldEqual("1");

            var subsetOne = data.SubsetByKey(key => key.StartsWith("One"));
            subsetOne.AllKeys.ShouldHaveTheSameElementsAs("One.A", "One.B", "One.C");
        }
示例#3
0
 public void subset_by_key_copies_category()
 {
     var data = new SettingsData(SettingCategory.package);
     data.SubsetByKey(key => true).Category.ShouldEqual(data.Category);
 }