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); }
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"); }
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"); }
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"); }
public static void SaveUserSettings() { LPConfig.SaveUserSettings(); }
public static void Init(TestContext context) { //remove LAPUserConfig.json LPConfig.ResetToGlobal(); }
public static void Initialize(TestContext context) { _config = new LPConfig("AppConfig.json"); }