Namespace Serenity.UnityGameUi.Tests.Infrastructure
Classes
HudElementOwnComponentCollectorTests
PlayMode tests for HudElementOwnComponentCollector — the generic, predicate-based walk
UnityHudElementView.CollectOwnText and UnityGraphicColorApplier now share. Uses the
real HudElementRootMarker type as the boundary predicate, exercising the exact shape both
production callers use, even though the collector itself takes any Func<Transform, bool> —
see that class's own remarks for why it is predicate-based rather than hard-coding this type.
HudSignalSerializationTests
Regression tests for the real-world bug where the HUD signals' payload fields were readonly,
which Unity never serializes — so a signal authored as a [SerializeReference] entry in a
GameMode's enter/exit signal list (UnityGameModeSignalConfiguration) always arrived with a
null payload. UnityEngine.JsonUtility applies the same "skip readonly fields" rule as Unity's
main serializer, so it reproduces the bug/fix cheaply; the asset-level round trip is covered by
UnityGameModeSettingsDefinitionEditorTests. These tests live in the Unity test assembly, not
the pure Business suite, because UnityEngine.JsonUtility is an engine API.
UnityGameHudPresenterTests
PlayMode tests for UnityGameHudPresenter. The presenter toggles a serialized HUD-root GameObject's active state. The private serialized field is injected via reflection to exercise both the active path and the null-guard path.
UnityGameResultsPresenterTests
PlayMode tests for UnityGameResultsPresenter. The presenter toggles a serialized results-root GameObject's active state. The private serialized field is injected via reflection to exercise both the active path and the null-guard path.
UnityGameScreenPresenterTests
PlayMode tests for UnityGameScreenPresenter. The presenter toggles the GameObject root mapped to the active screen id and deactivates every other mapped root. The private serialized list is injected via reflection to exercise the matching path, the deactivation-of-others path, and the null-guard path.
UnityGameUiServiceTests
PlayMode tests for UnityGameUiService.
The service is a MonoBehaviour driven via AddComponent + its public API.
Verifies UiState tracking and forwarding to injected presenters (spy ports).
UnityHudDefinitionProviderTests
Tests for UnityHudDefinitionProvider, entirely via an injected loader so no test touches real Addressables.
UnityHudElementAnimationTests
Tests for UnityHudElementAnimation's data model: its authored defaults and the two members it derives rather than stores verbatim — HasAnimationAsset and the normalized CooldownSeconds. Pure construction and reflection, with no view, no host and no live scene — the layer asset itself is the only Unity object involved.
UnityHudElementViewTests
PlayMode tests for UnityHudElementView built the way the game builds it — through
Build, with a live service resolver — rather than through the preview.
UnityHudFractionPartRepresentationTests
Tests for UnityHudFractionPartRepresentation: it renders only the fractional part of a bound number, floored and zero-padded to a chosen digit count, paired with UnityHudIntegerPartRepresentation so a flexbox can show a large integer beside a smaller, faster-ticking fraction.
UnityHudHostComponentTests
PlayMode tests for the two pieces the game uses that the preview never touches: the widget-context constructor of HudRenderResources, and UnityHudHostComponent driving a HUD through a service locator.
UnityHudIntegerPartRepresentationTests
Tests for UnityHudIntegerPartRepresentation: it renders only the floored integer part of a bound number, with the same zero padding and thousands grouping UnityHudNumberRepresentation offers for a whole number.
Interfaces
UnityHudElementViewTests.IFakeScoreService
A stand-in for a game service a HUD would bind to.