public void Set_Save_Reset_No_Auto_Save() { DeleteSettingsFiles(); ATestSettingsClass.Load(TestHelpers.AssemblyDirectory); Assert.Equal("ADefault", ATestSettingsClass.Instance.ASetting); var randomString = TestHelpers.RandomString(20); ATestSettingsClass.Instance.ASetting = randomString; ATestSettingsClass.Save(); Assert.Equal(randomString, ATestSettingsClass.Instance.ASetting); ATestSettingsClass.Load(TestHelpers.AssemblyDirectory); Assert.Equal(randomString, ATestSettingsClass.Instance.ASetting); ATestSettingsClass.ResetToDefaults(false); ATestSettingsClass.Load(TestHelpers.AssemblyDirectory); Assert.Equal(randomString, ATestSettingsClass.Instance.ASetting); DeleteSettingsFiles(); }
public void Set_Save() { ATestSettingsClass.Load(TestHelpers.AssemblyDirectory); Assert.Equal("ADefault", ATestSettingsClass.Instance.ASetting); var randomString = TestHelpers.RandomString(20); ATestSettingsClass.Instance.ASetting = randomString; ATestSettingsClass.Save(); Assert.Equal(randomString, ATestSettingsClass.Instance.ASetting); Assert.True(File.Exists(Path.Combine(TestHelpers.AssemblyDirectory, "ATestSettingsClass.json"))); DeleteSettingsFiles(); }
public void Multi_Settings_Files_Do_Not_Collide_Dirs() { ATestSettingsClass.Load(TestHelpers.AssemblyDirectory); BTestSettingsClass.Load(TestHelpers.AssemblyDirectory); Assert.Equal("ADefault", ATestSettingsClass.Instance.ASetting); Assert.Equal("BDefault", BTestSettingsClass.Instance.BSetting); ATestSettingsClass.Save(); BTestSettingsClass.Save(); ATestSettingsClass.Load(TestHelpers.AssemblyDirectory); BTestSettingsClass.Load(TestHelpers.AssemblyDirectory); Assert.Equal("ADefault", ATestSettingsClass.Instance.ASetting); Assert.Equal("BDefault", BTestSettingsClass.Instance.BSetting); DeleteSettingsFiles(); }
public void Custom_File_Name_Used() { string testFileName = "test-file.json"; ATestSettingsClass.Load(TestHelpers.AssemblyDirectory, testFileName); var randomString = TestHelpers.RandomString(20); ATestSettingsClass.Instance.ASetting = randomString; ATestSettingsClass.Save(); Assert.True(File.Exists(Path.Combine(TestHelpers.AssemblyDirectory, testFileName))); ATestSettingsClass.Load(TestHelpers.AssemblyDirectory); Assert.Equal("ADefault", ATestSettingsClass.Instance.ASetting); DeleteSettingsFiles(); }