Files
PJB3005 788e9386fd Split up test project
Robust.UnitTesting was both ALL tests for RT, and also API surface for content tests.

Tests are now split into separate projects as appropriate, and the API side has also been split off.
2025-12-16 01:36:53 +01:00

45 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using NUnit.Framework;
using Robust.Shared.ContentPack;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
namespace Robust.UnitTesting.Shared.Localization;
[TestFixture]
internal sealed class LoadLocalizationTest : OurRobustUnitTest
{
private const string DuplicateTerm = @"
term1 = 1
term1 = 2
";
protected override void OverrideIoC()
{
base.OverrideIoC();
IoCManager.Register<ILogManager, SpyLogManager>(overwrite: true);
}
[Test]
public void TestLoadLocalization()
{
var res = IoCManager.Resolve<IResourceManagerInternal>();
res.MountString("/Locale/en-US/a.ftl", DuplicateTerm);
var loc = IoCManager.Resolve<ILocalizationManager>();
loc.Initialize();
var spyLog = (SpyLogManager) IoCManager.Resolve<ILogManager>();
var culture = new CultureInfo("en-US", false);
var x = spyLog.CountError;
loc.LoadCulture(culture);
Assert.That(spyLog.CountError, NUnit.Framework.Is.GreaterThan(x));
}
}