Adds Avalonia 11 + CommunityToolkit.Mvvm package references (no UI code yet), a flat-key Loc resource loader with embedded cs.json/en.json, the LauncherSettings JSON store with dev-mode-gated manifest URL override, and an optional IProgress<long> bytesProgress hook on BlobDownloader so the upcoming GUI can drive a progress bar from per-blob byte counts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
945 B
C#
43 lines
945 B
C#
using Metin2Launcher.Localization;
|
|
using Xunit;
|
|
|
|
namespace Metin2Launcher.Tests;
|
|
|
|
public class LocTests
|
|
{
|
|
[Fact]
|
|
public void Returns_value_for_known_key_in_cs()
|
|
{
|
|
Loc.SetLocale("cs");
|
|
Assert.Equal("Hrát", Loc.Get("button.play"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Returns_value_for_known_key_in_en()
|
|
{
|
|
Loc.SetLocale("en");
|
|
Assert.Equal("Play", Loc.Get("button.play"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Falls_back_to_key_for_unknown()
|
|
{
|
|
Loc.SetLocale("en");
|
|
Assert.Equal("nope.does.not.exist", Loc.Get("nope.does.not.exist"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Format_substitutes_args()
|
|
{
|
|
Loc.SetLocale("en");
|
|
Assert.Equal("Previous version 0.1.0", Loc.Get("news.previousHeader", "0.1.0"));
|
|
}
|
|
|
|
[Fact]
|
|
public void Unknown_locale_falls_back_to_en()
|
|
{
|
|
Loc.SetLocale("xx");
|
|
Assert.Equal("Play", Loc.Get("button.play"));
|
|
}
|
|
}
|