public void ChangingSelectedLocale_SendsLocaleChangedEvent() { Locale selectedLocale = null; m_Settings.OnSelectedLocaleChanged += (loc) => selectedLocale = loc; // Change the locale resulting in the event being sent. var japaneseLocale = m_Settings.GetAvailableLocales().GetLocale(SystemLanguage.Japanese); Assert.IsNotNull(japaneseLocale, "Expected Japanese locale to be returned but it was not."); m_Settings.SetSelectedLocale(japaneseLocale); Assert.IsNotNull(selectedLocale, "Current language is null, the LocaleChanged event was not sent."); Assert.AreEqual(japaneseLocale, selectedLocale, "Expected current language to be Japanese."); }
public void PlayerPrefLocaleSelector_WhenLocaleIsChanged_RecordsLocaleToPlayerPrefs() { var spanish = m_TestSettings.GetAvailableLocales().GetLocale(SystemLanguage.Spanish); Assert.NotNull(spanish); Assert.AreNotEqual(m_TestSettings.GetSelectedLocale(), spanish); m_TestSettings.SetSelectedLocale(spanish); Assert.IsTrue(PlayerPrefs.HasKey(k_PlayerPrefKey), "Expected Player Pref Key to be set when the selected locale was changed."); var pref = PlayerPrefs.GetString(k_PlayerPrefKey); Assert.AreEqual(spanish.Identifier.Code, pref, "Expected the player prefs to contain the selected locale"); }