using Microsoft.Extensions.Options;
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Tests.TestSupport;
///
/// Minimal test double with a mutable
/// so a test can flip a value mid-run and assert the NEXT read observes it
/// — used by the WP3.2 hot-toggle tests
/// (SiteRuntimeOptions.PerRunScriptEvents/PerRunScriptEventScripts are read via
/// IOptionsMonitor.CurrentValue per run specifically so they don't need a restart).
/// Avoids depending on Microsoft.Extensions.Configuration's reload-token plumbing,
/// which is awkward to drive deterministically from xUnit.
///
public sealed class TestOptionsMonitor(T initial) : IOptionsMonitor
{
private T _current = initial;
///
public T CurrentValue => _current;
///
public T Get(string? name) => _current;
///
public IDisposable? OnChange(Action listener) => null;
/// Replaces the current value, observed by the next read.
public void Set(T value) => _current = value;
}