modular-avatar/UnitTests~/LocalizationTest.cs
bd_ ddbc3b164b
chore: restructure repository to put package at top-level (#477)
* chore: rearrange package structure to have the package at the root

* ci: update CI workflows

* ci: fixing workflow bugs

* ci: recurse building .zip package

* ci: more fixes

* ci: add back in the nadena.dev VPM repo

* ci: fix tests
2023-10-08 15:39:57 +09:00

35 lines
1.0 KiB
C#

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");
}
}
}