Esempio n. 1
0
        public void SetUp()
        {
            this._emptySettingProvider = MockRepository.GenerateMock <IEmptySettingsProvider>();
            this._emptySettingProvider.Stub(x => x.GetSettings())
            .Return(
                new List <ISetting>
            {
                new FakeColorSetting {
                    Accent = Color.Fuchsia, Theme = Theme.Dark
                },
                new FakeLoginSetting {
                    Database = "Databasse", Login = "******"
                }
            });
            _settingModel = new SettingsModel {
                Application = "Halfblood", SettingsInJson = J_S_O_N
            };
            _service      = MockRepository.GenerateMock <ISettingsService>();
            _parseSetting = MockRepository.GenerateMock <IParserSetting>();
            _service.Stub(x => x.Get("Halfblood")).Return(_settingModel);
            _parseSetting.Stub(x => x.Parse(_settingModel)).Return(new List <ISetting> {
                new ColorSetting()
            });

            _settingManager = SettingsManager.Create(
                _service,
                "Halfblood",
                _parseSetting,
                this._emptySettingProvider);
        }
Esempio n. 2
0
        public static ISettingsManager Create(
            ISettingsService settingsService,
            string appName,
            IParserSetting parserSetting,
            IEmptySettingsProvider emptySettingsProvider)
        {
            Contract.Requires(parserSetting != null);
            Contract.Requires(settingsService != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(appName));

            SettingsManager.emptySettingsProvider = emptySettingsProvider;

            var settingManager = new SettingsManager(settingsService, appName, parserSetting);

            settingManager.Synchronization();

            return(settingManager);
        }
Esempio n. 3
0
 public ParserSetting(
     IEmptySettingsProvider emptySettingsProvider,
     [Import("LOCAL")] IEmptySettingsProvider localeEmptySettingsProvider)
 {
     _settings = emptySettingsProvider.GetSettings().Concat(localeEmptySettingsProvider.GetSettings());
 }