logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Namespace Serenity.UnityModal.Tests.Infrastructure

    Classes

    ModalOptionSignalDispatcherTests

    Tests for ModalOptionSignalDispatcher: each submit signal reaches the event dispatcher exactly once per press, even when one of those signals re-fires the same submit synchronously — the input-map switch that produced the modal double submit. Exemplar: UnityMenuSubmitServiceTests (its TestSignal / capturing dispatcher / MakeOption shape).

    ShowModalTriggerTestSignal

    The signal a show-modal trigger under test listens for; carries nothing.

    StubModalComponent

    The Unity-lifetime counterpart of UnityModalServiceTests.StubModal: a modal that can actually be destroyed, which is what a real modal is and what the plain C# stub can never be. Only a UnityEngine.Object reaches the "destroyed but not null" state the close-modal guard exists for, so this is the fixture that pins UnityObjectUtils.IsAlive against a plain == null check. Lives in its own file because Unity binds a MonoBehaviour script by file name.

    TestableModalService

    Opens UnityModalService's protected close-modal handler to UnityModalServiceTests, which is the only way to exercise it without a live event dispatcher and a real modal prefab. Lives in its own file because Unity binds a MonoBehaviour script by file name; nothing else may use it.

    UnityModalComponentFactoryTests

    Tests for UnityModalComponentFactory's value-persistence logic (SetOptionValue and the bounds/null guards of ShiftOptionValue) and the CreateUiComponent validation guards. The component-mutating branches of ShiftOptionValue require a real interactable component and are covered only through their early-return guards here.

    UnityModalOptionsBuilderTests

    Tests for CreateModalOptions(IReadOnlyList<UiOption>, IUiThemeDefinition). Only the option-free guard path is unit-testable without real prefab templates: a null options list returns an empty interactable list before the component creator is ever touched (so it is safe to pass a null creator). Rendering actual options requires a populated UI theme and prefab hierarchy and is left to PlayMode/scene coverage.

    UnityModalServiceTests

    Tests for ShouldUseOptionsPipeline(OnShowModalInput), the branch that decides whether ShowModal(OnShowModalInput) renders the rich UiOption pipeline or falls back to the legacy button factory, and for the close-modal handler's nothing-to-close guard. The rest of ShowModal builds a real UI component hierarchy from a theme's prefab templates and is left to PlayMode/scene coverage; these decisions are the pieces that are safe and meaningful to isolate.

    UnityShowModalComponentDispatcherTests

    A show-modal trigger listens for its signal on the event dispatcher the modal installer hands it. It must never go looking for a game settings service in the scene to borrow one: a project booting through both the bootstrap and a canonical profile can hold two such services, and the one the lookup found had no dispatcher, so every trigger threw at start-up. A trigger that was handed no dispatcher says once which boot task creates working triggers, and does nothing else. A trigger whose modal setting has no signal says once which field to fill, and listens for nothing.

    UnityShowModalComponentFactoryTests

    Tests for CreateComponent<Element, Parameters, Actions>(Parameters, Actions): it must create a GameObject, attach a UnityShowModalComponent, push parameters into it, and return the attached element.

    In this article
    © 2026 Serenity. All Rights Reserved