namespace ZB.MOM.WW.MxGateway.Tests.TestSupport;
///
/// with a manually advanced clock for deterministic
/// timestamp / heartbeat / lease tests. Tests inject one of these instead of
/// so timing assertions don't depend on the
/// wall clock. Constructed without arguments (or with default) it seeds
/// from ; for fully deterministic tests pass
/// an explicit start instant.
///
/// Initial clock value. When default, the clock seeds from .
public sealed class ManualTimeProvider(DateTimeOffset start = default) : TimeProvider
{
private DateTimeOffset _now = start == default ? DateTimeOffset.UtcNow : start;
///
public override DateTimeOffset GetUtcNow() => _now;
/// Advances the manual clock by the given amount.
/// Amount of time to add to the current clock value.
public void Advance(TimeSpan delta) => _now += delta;
}