namespace Cthangover.Mods.Dialog.Tests
{
using System.Collections.Generic;
using Cthangover.Core.Events;
///
/// Records every published on the mod event bus
/// between and — the locker id of each, in
/// publication order. Tests count how often a queue reported its end.
///
public class DialogEndRecorder
{
/// Locker ids of the recorded events (null for a locker-less dialog).
public List LockerIds { get; } = new();
/// Subscribes to the event bus.
public void Start()
{
ModEventBus.Subscribe(OnDialogEnded);
}
/// Unsubscribes; call it in finally so a failed test leaves no handler behind.
public void Stop()
{
ModEventBus.Unsubscribe(OnDialogEnded);
}
private void OnDialogEnded(DialogEndedEvent evt)
{
LockerIds.Add(evt.LockerId);
}
}
}