Example #1
0
        public void SettingService_DeleteSetting_CallsSessionDelete()
        {
            var setting = new Setting();
            Session.Transact(session => session.Save(setting));

            _settingService.DeleteSetting(setting);

            Session.QueryOver<Setting>().RowCount().Should().Be(0);
        }
Example #2
0
        public void SettingService_GetSettingById_LoadsFromSession()
        {
            var setting = new Setting();
            Session.Transact(session => session.Save(setting));

            var settingById = _settingService.GetSettingById(1);

            settingById.Should().Be(setting);
        }
Example #3
0
        public void SettingService_GetSettingByKey_ReturnsTheSettingsObjectWithTheValidKey()
        {
            var setting1 = new Setting { Name = "test", Value = "value", Site = CurrentSite };
            Session.Transact(session => session.Save(setting1));
            var setting2 = new Setting { Name = "test2", Value = "value2", Site = CurrentSite };
            Session.Transact(session => session.Save(setting2));

            _settingService.GetSettingByKey("test2").Should().Be(setting2);
        }
Example #4
0
        public void SettingService_GetSettingValueByKey_DefaultWhenKeyDoesNotExist()
        {
            var setting1 = new Setting { Name = "test", Value = "value", Site = CurrentSite };
            Session.Transact(session => session.Save(setting1));

            _settingService.GetSettingValueByKey("test2", "default").Should().Be("default");
        }
Example #5
0
        public void SettingService_GetSettingValueByKey_ReturnsValueForSetting()
        {
            var setting1 = new Setting { Name = "test", Value = "value", Site = CurrentSite };
            Session.Transact(session => session.Save(setting1));
            var setting2 = new Setting { Name = "test2", Value = "value2", Site = CurrentSite };
            Session.Transact(session => session.Save(setting2));

            _settingService.GetSettingValueByKey("test2", "default").Should().Be("value2");
        }
Example #6
0
        public void SettingService_GetSettingByKey_ReturnsNullIfTheKeyDoesNotExist()
        {
            var setting1 = new Setting { Name = "test", Value = "value", Site = CurrentSite };
            Session.Transact(session => session.Save(setting1));

            _settingService.GetSettingByKey("test2").Should().Be(null);
        }