Esempio n. 1
0
        public void GetAll()
        {
            var dict    = new Dictionary <string, SettingDefinition>();
            var context = new SettingDefinitionContext(dict);

            context.GetAll().ShouldBeEmpty();
            Should.NotThrow(() => context.Add(new SettingDefinition <string>("Setting")));
            context.GetAll().ShouldHaveSingleItem().Name.ShouldBe("Setting");
        }
Esempio n. 2
0
        public void GetOrNull()
        {
            var dict    = new Dictionary <string, SettingDefinition>();
            var context = new SettingDefinitionContext(dict);

            Should.NotThrow(() => context.Add(new SettingDefinition <string>("Setting")));
            context.GetOrNull("Setting").ShouldNotBeNull();
            context.GetOrNull("NotExistsSetting").ShouldBeNull();
        }
Esempio n. 3
0
        public void Add()
        {
            var dict    = new Dictionary <string, SettingDefinition>();
            var context = new SettingDefinitionContext(dict);

            Should.NotThrow(() => context.Add());
            dict.Count.ShouldBe(0);
            Should.NotThrow(() => context.Add(new SettingDefinition <string>("Setting")));
            dict.ShouldHaveSingleItem().Key.ShouldBe("Setting");
        }