modular-avatar/UnitTests~/LocalizationTest.cs

35 lines
1.0 KiB
C#
Raw Normal View History

using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework;
namespace modular_avatar_tests
{
public class LocalizationTest
{
[SetUp]
public void Setup()
{
Localization.OverrideLanguage = null;
Localization.Reload();
}
[TearDown]
public void Teardown()
{
Localization.OverrideLanguage = null;
}
[Test]
public void TestLanguageFallback()
{
Localization.OverrideLanguage = "test";
Assert.AreEqual(Localization.S("test0.test_a"), "replaced");
Assert.AreEqual(Localization.S("test0.test_b"), "test_b");
Assert.AreEqual(Localization.S("test0.test_c"), "test0.test_c");
Localization.OverrideLanguage = "en";
Assert.AreEqual(Localization.S("test0.test_a"), "test_a");
Assert.AreEqual(Localization.S("test0.test_b"), "test_b");
Assert.AreEqual(Localization.S("test0.test_c"), "test0.test_c");
}
}
}