Exemplo n.º 1
0
        public void LPConfig_GetUserConfigPath()
        {
            string path = LPConfig.GetUserConfigPath();

            bool result = path.StartsWith("C:\\Users") && path.EndsWith("LAPUserConfig.json");

            Assert.IsTrue(result, "returned path is " + path);
        }
Exemplo n.º 2
0
        public void SpySettings_ToggleLanguage()
        {
            AppLanguageEnum oldLanguage = SpySettings.Language;

            //toggle to a different language
            SpySettings.Language = (oldLanguage == AppLanguageEnum.English) ? AppLanguageEnum.Chinese : AppLanguageEnum.English;

            SpySettings.SaveUserSettings();

            LPConfig.ReloadConfig();

            Assert.AreNotEqual(oldLanguage, SpySettings.Language, "The toggled the language value should be different");
        }
Exemplo n.º 3
0
        public void SpySettings_ToggleCaptureSnapshots()
        {
            bool captureSnapshots = SpySettings.CaptureSnapshots;

            //default should be true;
            Assert.AreEqual(true, captureSnapshots);

            //toggle to a different language
            SpySettings.CaptureSnapshots = !captureSnapshots;

            SpySettings.SaveUserSettings();

            LPConfig.ReloadConfig();

            Assert.AreNotEqual(captureSnapshots, SpySettings.CaptureSnapshots, "The toggled the CaptureSnapshots setting should be different");
        }
Exemplo n.º 4
0
        public void LPConfig_SaveSettings()
        {
            string userConfigPath = LPConfig.GetUserConfigPath().Replace(".json", "UnitTest.json");

            if (File.Exists(userConfigPath))
            {
                File.Delete(userConfigPath);
            }

            string testValue = "Test value " + Guid.NewGuid().ToString();

            _config.SetSettings("TestKey", testValue);

            _config.SaveSettings(userConfigPath);

            Assert.IsTrue(File.Exists(userConfigPath), "File exists " + userConfigPath);

            LPConfig newConfig = new LPConfig(userConfigPath);
            string   value     = newConfig.GetSetting <string>("TestKey");

            Assert.AreEqual(testValue, value, "Get value should be the same as saved value");
        }
Exemplo n.º 5
0
 public static void SaveUserSettings()
 {
     LPConfig.SaveUserSettings();
 }
Exemplo n.º 6
0
 public static void Init(TestContext context)
 {
     //remove LAPUserConfig.json
     LPConfig.ResetToGlobal();
 }
Exemplo n.º 7
0
 public static void Initialize(TestContext context)
 {
     _config = new LPConfig("AppConfig.json");
 }