Class 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.
Inherited Members
Namespace: Serenity.UnityModal.Tests.Infrastructure
Assembly: Tests.dll
Syntax
public class UnityModalServiceTests
Constructors
UnityModalServiceTests()
Declaration
public UnityModalServiceTests()
Methods
EmptyOptions_ReturnsFalse()
Declaration
public void EmptyOptions_ReturnsFalse()
NullOptions_ReturnsFalse()
Declaration
public void NullOptions_ReturnsFalse()
OnCloseModal_DestroyedCurrentModal_DoesNotThrow()
The reason the guard asks UnityObjectUtils.IsAlive instead of == null: the
current-modal field is interface-typed, so a destroyed modal still passes a plain reference-null
check and the handler would start the destroy coroutine over a corpse. A real modal IS a
UnityEngine.Object, which the plain StubModal can never be.
Declaration
public void OnCloseModal_DestroyedCurrentModal_DoesNotThrow()
OnCloseModal_NoCurrentModal_DoesNotThrow()
The fixture never wires a modal or a player input service, which is exactly the state a second close signal finds after the first one already destroyed the modal. Without the guard the handler starts the destroy coroutine, whose first synchronous segment dereferences the now-null modal.
Declaration
public void OnCloseModal_NoCurrentModal_DoesNotThrow()
OnCloseModal_NoCurrentModal_LogsVerboseAndTouchesNothingElse()
Declaration
public void OnCloseModal_NoCurrentModal_LogsVerboseAndTouchesNothingElse()
OnCloseModal_WithACurrentModal_StillClosesIt()
Declaration
public void OnCloseModal_WithACurrentModal_StillClosesIt()
PopulatedOptions_NoBuilderWired_ReturnsFalse()
Declaration
public void PopulatedOptions_NoBuilderWired_ReturnsFalse()
PopulatedOptions_WithBuilderWired_ReturnsTrue()
Declaration
public void PopulatedOptions_WithBuilderWired_ReturnsTrue()
SetUp()
Declaration
public void SetUp()
ShowModal_ThatCannotProceed_LeavesTheOpenModalAlone()
Pins the ordering of CloseAnyOpenModal against the factory and theme guards it sits behind:
a show that cannot proceed must leave the open modal alone rather than close it and put nothing in
its place. The positive case — a second show really does destroy the first modal — needs a real
component factory and a theme's prefab templates, so it is covered by Play testing, not here.
Declaration
public void ShowModal_ThatCannotProceed_LeavesTheOpenModalAlone()
TearDown()
Declaration
public void TearDown()