Namespace Serenity.Localization.Tests.Editor
Classes
LocalizationAddressablesTestCleanup
Removes the Addressables groups and labels Unity Localization's own package machinery auto-creates per
locale, which live under Assets/AddressableAssetsData rather than any fixture's own temp folder
and so survive that fixture's path-prefix Addressables-entry sweep entirely. Shared by every Localization
editor test fixture that registers ephemeral locales, and by the pattern-based sweeps in
LocalizationEphemeralGroupGuard and LocalizationTestGroupLeakSentinel, so the
cleanup is written once instead of copied per file.
LocalizationCollectionAdoptionMetadataTests
Adopting a shipped localization collection makes a project-owned copy of it, and a copy is only faithful if it carries what the author attached to the shipped keys and translations: a comment on a key (shared by every locale), a comment on one translation, and the smart-format tag. Dropping them loses translator context the author never chose to discard.
LocalizationEphemeralGroupGuard
Kills the per-locale Addressables groups and labels Unity Localization creates for a fixture's
pseudo-locale codes as soon as they materialize. Unity Localization registers a collection's tables into
Addressables from its asset postprocessor (ImportCollectionIntoProject), so the creation rides the
asset import pipeline and lands whenever an import batch flushes — after the creating fixture's
[TearDown] and even after the namespace-level LocalizationTestGroupLeakSentinel has
already run. Synchronous teardown cleanup therefore sweeps before the groups exist and never sees them.
LocalizationKeyValidatorFixtureDefinition
Minimal ScriptableObject fixture that exercises the IsTranslating<Field> convention consumed by
SerenityLocalizationKeyValidator, without depending on any shipped Serenity asset type.
LocalizationTestGroupLeakSentinel
Assembly-level safety net for the per-locale Addressables groups and labels Unity Localization
auto-creates for every fixture locale these tests register (see
LocalizationAddressablesTestCleanup and LocalizationEphemeralGroupGuard).
A [SetUpFixture] at the namespace root, so each hook runs exactly once per test run — once before
the first test in this namespace tree, and once after the last — not once per test. The setup sweep is
silent (leftovers may predate the fix or come from an aborted run); the teardown sweep fails loudly so a
fixture that stops cleaning up turns into a suite failure instead of silent working-tree pollution.
SerenityLocalizationKeyValidatorPerLocaleTests
EditMode tests for the per-locale empty-translation reporting added to
Run(SerenityValidationReport, bool). Every fixture lives under a private temp folder and uses
fixture-only locale codes (never "en"/"es", which the shipped project already registers globally) so these
tests stay hermetic regardless of what the project already ships — mirrors the discipline in
LocalizationSettingsCreatorTests.
SerenityLocalizationValidationRegistrationTests
EditMode test proving SerenityLocalizationValidationRegistration's static constructor ran on
domain load — SerenityProjectValidationRunner only scans translation keys if this
registration actually fired, because the Hub no longer references this module's editor assembly
(design ADR-1). The registered runner is not invoked here: it scans every ScriptableObject in the
project, and SerenityLocalizationKeyValidatorPerLocaleTests already covers what it finds.
UnityLocalizationLocaleCreationTests
EditMode round-trip tests for the two reflection bridges that add a language to the project — Serenity.Global.Infrastructure.Editor.UnityLocalizationLocaleEditorUtils.TryEnsureLocale(System.String,System.String) and Serenity.Global.Infrastructure.Editor.UnityLocalizationStringTableEditorUtils.TryAddLocaleTable(System.String,System.String) — against a real, ephemeral Unity Localization collection. Fixture locale codes are "zpk"-prefixed, never "en"/"es", so the run stays hermetic regardless of what the project already ships.
UnityLocalizationLocaleEditorUtilsTests
EditMode tests for the selected-locale helpers on Serenity.Global.Infrastructure.Editor.UnityLocalizationLocaleEditorUtils.
Mutates the project's real LocalizationSettings.SelectedLocale (there is no sandboxed equivalent for
this global piece of state), so every test captures it in SetUp() and restores it in
TearDown() — the same non-pollution discipline the Addressables fixtures follow.
UnityLocalizationStringTableEditorUtilsTests
EditMode round-trip tests for Serenity.Global.Infrastructure.Editor.UnityLocalizationStringTableEditorUtils (Serenity.Global.Infrastructure.Editor.UnityLocalizationStringTableEditorUtils.GetStringTableCollectionNames, Serenity.Global.Infrastructure.Editor.UnityLocalizationStringTableEditorUtils.GetLocaleCodesOf(System.String), Serenity.Global.Infrastructure.Editor.UnityLocalizationStringTableEditorUtils.TryGetStringTableEntry(System.String,System.String,System.String,System.String@) and Serenity.Global.Infrastructure.Editor.UnityLocalizationStringTableEditorUtils.TrySetStringTableEntry(System.String,System.String,System.String,System.String)), against a real, ephemeral Unity Localization string table collection. Mirrors SerenityLocalizationKeyValidatorPerLocaleTests's fixture-only locale-code discipline ("zpk" codes, never "en"/"es") so this stays hermetic regardless of what the project already ships.