public void WhenSettingsSaved_ThenSettingsCanBeRead()
        {
            var baseKey    = hkcu.CreateSubKey(TestKeyPath);
            var repository = new ApplicationSettingsRepository(baseKey);

            var settings = repository.GetSettings();

            settings.IsMainWindowMaximized.BoolValue = true;
            settings.MainWindowHeight.IntValue       = 480;
            settings.MainWindowWidth.IntValue        = 640;
            settings.IsUpdateCheckEnabled.BoolValue  = false;
            settings.LastUpdateCheck.LongValue       = 123L;
            repository.SetSettings(settings);

            settings = repository.GetSettings();

            Assert.AreEqual(true, settings.IsMainWindowMaximized.BoolValue);
            Assert.AreEqual(480, settings.MainWindowHeight.IntValue);
            Assert.AreEqual(640, settings.MainWindowWidth.IntValue);
            Assert.AreEqual(false, settings.IsUpdateCheckEnabled.BoolValue);
            Assert.AreEqual(123, settings.LastUpdateCheck.LongValue);
        }
示例#2
0
        public void WhenSettingsSaved_ThenSettingsCanBeRead()
        {
            var baseKey    = hkcu.CreateSubKey(TestKeyPath);
            var repository = new ApplicationSettingsRepository(baseKey);

            repository.SetSettings(new ApplicationSettings()
            {
                IsMainWindowMaximized = true,
                MainWindowHeight      = 480,
                MainWindowWidth       = 640,
                IsUpdateCheckEnabled  = false,
                LastUpdateCheck       = 123
            });

            var settings = repository.GetSettings();

            Assert.IsTrue(settings.IsMainWindowMaximized);
            Assert.AreEqual(480, settings.MainWindowHeight);
            Assert.AreEqual(640, settings.MainWindowWidth);
            Assert.AreEqual(false, settings.IsUpdateCheckEnabled);
            Assert.AreEqual(123, settings.LastUpdateCheck);
        }