refactor(CS): schedule + periods are config-owned, AdminPanel-editable
Some checks failed
.NET Core / build (push) Has been cancelled
Some checks failed
.NET Core / build (push) Has been cancelled
Move the auto-schedule from context-owned state to the plugin config (single source of truth): RegistrationOpenDays + RegistrationOpenTimes + Registration/Preparation/ SiegeDuration are all editable in the AdminPanel plugin config and take effect live (context refreshes its config reference each tick via UpdateConfiguration). /csschedule now writes the config. Removed the duplicate Persisted schedule fields. 12 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,19 +10,29 @@ namespace MUnique.OpenMU.GameLogic.CastleSiege;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CastleSiegeConfiguration
|
public class CastleSiegeConfiguration
|
||||||
{
|
{
|
||||||
|
// --- Schedule & period lengths (editable in the AdminPanel) ---
|
||||||
|
// A cycle runs: Ownership -> Registration -> Preparation -> Siege(war) -> Settlement -> Ownership.
|
||||||
|
// It auto-starts when the current day/time matches RegistrationOpenDays + RegistrationOpenTimes.
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the times of day at which a new cycle opens registration.
|
/// Gets or sets the days of week on which registration auto-opens (UTC). Empty = every day
|
||||||
/// Empty by default; admins start cycles manually via chat command in P1.
|
/// (still requires a time in <see cref="RegistrationOpenTimes"/>); with no times set, auto-start is off.
|
||||||
|
/// </summary>
|
||||||
|
public IList<DayOfWeek> RegistrationOpenDays { get; set; } = new List<DayOfWeek>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the times of day (UTC) at which a new cycle opens registration.
|
||||||
|
/// Empty = no auto-start (admins start cycles manually via chat command).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<TimeOnly> RegistrationOpenTimes { get; set; } = new List<TimeOnly>();
|
public IList<TimeOnly> RegistrationOpenTimes { get; set; } = new List<TimeOnly>();
|
||||||
|
|
||||||
/// <summary>Gets or sets how long the registration phase lasts.</summary>
|
/// <summary>Gets or sets how long the registration period lasts (guilds may register).</summary>
|
||||||
public TimeSpan RegistrationDuration { get; set; } = TimeSpan.FromMinutes(5);
|
public TimeSpan RegistrationDuration { get; set; } = TimeSpan.FromMinutes(5);
|
||||||
|
|
||||||
/// <summary>Gets or sets how long the preparation phase lasts.</summary>
|
/// <summary>Gets or sets how long the preparation period lasts (between registration close and the war).</summary>
|
||||||
public TimeSpan PreparationDuration { get; set; } = TimeSpan.FromMinutes(2);
|
public TimeSpan PreparationDuration { get; set; } = TimeSpan.FromMinutes(2);
|
||||||
|
|
||||||
/// <summary>Gets or sets how long the siege phase lasts.</summary>
|
/// <summary>Gets or sets how long the war (siege) period lasts.</summary>
|
||||||
public TimeSpan SiegeDuration { get; set; } = TimeSpan.FromMinutes(10);
|
public TimeSpan SiegeDuration { get; set; } = TimeSpan.FromMinutes(10);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -48,15 +58,10 @@ public class CastleSiegeConfiguration
|
|||||||
/// <summary>Gets or sets the persisted registered guild names for the current cycle.</summary>
|
/// <summary>Gets or sets the persisted registered guild names for the current cycle.</summary>
|
||||||
public IList<string> PersistedRegisteredGuilds { get; set; } = new List<string>();
|
public IList<string> PersistedRegisteredGuilds { get; set; } = new List<string>();
|
||||||
|
|
||||||
/// <summary>Gets or sets the persisted auto-schedule days of week (empty = manual start only).</summary>
|
|
||||||
public IList<DayOfWeek> PersistedScheduleDays { get; set; } = new List<DayOfWeek>();
|
|
||||||
|
|
||||||
/// <summary>Gets or sets the persisted auto-schedule UTC time of day, or null if unscheduled.</summary>
|
|
||||||
public TimeOnly? PersistedScheduleTime { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if <paramref name="now"/> falls within a 5-second window of any configured
|
/// Returns true if <paramref name="now"/> (UTC) matches a scheduled registration-open day and falls
|
||||||
/// registration-open time.
|
/// within a 5-second window of a configured open time. When <see cref="RegistrationOpenDays"/> is empty,
|
||||||
|
/// the day is not restricted (every day). When no times are configured, auto-start is disabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="now">The current UTC time.</param>
|
/// <param name="now">The current UTC time.</param>
|
||||||
public bool IsRegistrationOpenTime(DateTime now)
|
public bool IsRegistrationOpenTime(DateTime now)
|
||||||
@@ -66,6 +71,11 @@ public class CastleSiegeConfiguration
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.RegistrationOpenDays.Count > 0 && !this.RegistrationOpenDays.Contains(now.DayOfWeek))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var nowTime = TimeOnly.FromDateTime(now);
|
var nowTime = TimeOnly.FromDateTime(now);
|
||||||
var earlier = nowTime.Add(TimeSpan.FromSeconds(-5));
|
var earlier = nowTime.Add(TimeSpan.FromSeconds(-5));
|
||||||
return this.RegistrationOpenTimes.Any(p => p.IsBetween(earlier, nowTime));
|
return this.RegistrationOpenTimes.Any(p => p.IsBetween(earlier, nowTime));
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ public class CastleSiegeContext
|
|||||||
private string? _occupier;
|
private string? _occupier;
|
||||||
private int _defensesRemaining;
|
private int _defensesRemaining;
|
||||||
private bool _dirty;
|
private bool _dirty;
|
||||||
private List<DayOfWeek> _scheduleDays = new();
|
|
||||||
private TimeOnly? _scheduleTime;
|
|
||||||
|
|
||||||
/// <summary>Initializes a new instance of the <see cref="CastleSiegeContext"/> class.</summary>
|
/// <summary>Initializes a new instance of the <see cref="CastleSiegeContext"/> class.</summary>
|
||||||
/// <param name="configuration">The cycle timing configuration.</param>
|
/// <param name="configuration">The cycle timing configuration.</param>
|
||||||
@@ -37,8 +35,13 @@ public class CastleSiegeContext
|
|||||||
/// <summary>Raised after the phase changes. Argument is the new phase.</summary>
|
/// <summary>Raised after the phase changes. Argument is the new phase.</summary>
|
||||||
public event Action<CastleSiegePhase>? PhaseChanged;
|
public event Action<CastleSiegePhase>? PhaseChanged;
|
||||||
|
|
||||||
/// <summary>Gets the configuration.</summary>
|
/// <summary>Gets the configuration (durations + schedule). Refreshed each tick from the live plugin config
|
||||||
public CastleSiegeConfiguration Configuration { get; }
|
/// so AdminPanel edits take effect without a restart.</summary>
|
||||||
|
public CastleSiegeConfiguration Configuration { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>Points the context at the current (possibly AdminPanel-edited) plugin configuration.</summary>
|
||||||
|
/// <param name="configuration">The live configuration.</param>
|
||||||
|
public void UpdateConfiguration(CastleSiegeConfiguration configuration) => this.Configuration = configuration;
|
||||||
|
|
||||||
/// <summary>Gets the current phase.</summary>
|
/// <summary>Gets the current phase.</summary>
|
||||||
public CastleSiegePhase Phase { get; private set; }
|
public CastleSiegePhase Phase { get; private set; }
|
||||||
@@ -58,12 +61,6 @@ public class CastleSiegeContext
|
|||||||
/// <summary>Gets the guild names registered for the current cycle.</summary>
|
/// <summary>Gets the guild names registered for the current cycle.</summary>
|
||||||
public IReadOnlyList<string> RegisteredGuilds => this._registeredGuilds;
|
public IReadOnlyList<string> RegisteredGuilds => this._registeredGuilds;
|
||||||
|
|
||||||
/// <summary>Gets the days of week the siege auto-opens registration (empty = manual start only).</summary>
|
|
||||||
public IReadOnlyList<DayOfWeek> ScheduleDays => this._scheduleDays;
|
|
||||||
|
|
||||||
/// <summary>Gets the UTC time of day registration auto-opens on scheduled days, or null if unscheduled.</summary>
|
|
||||||
public TimeOnly? ScheduleTime => this._scheduleTime;
|
|
||||||
|
|
||||||
/// <summary>Advances the state machine based on the current time.</summary>
|
/// <summary>Advances the state machine based on the current time.</summary>
|
||||||
/// <param name="now">The current UTC time.</param>
|
/// <param name="now">The current UTC time.</param>
|
||||||
public ValueTask TickAsync(DateTime now)
|
public ValueTask TickAsync(DateTime now)
|
||||||
@@ -71,7 +68,7 @@ public class CastleSiegeContext
|
|||||||
switch (this.Phase)
|
switch (this.Phase)
|
||||||
{
|
{
|
||||||
case CastleSiegePhase.Ownership:
|
case CastleSiegePhase.Ownership:
|
||||||
if (this.ShouldOpenRegistration(now))
|
if (this.Configuration.IsRegistrationOpenTime(now))
|
||||||
{
|
{
|
||||||
return this.ForceStartRegistrationAsync(now);
|
return this.ForceStartRegistrationAsync(now);
|
||||||
}
|
}
|
||||||
@@ -159,40 +156,22 @@ public class CastleSiegeContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the weekly auto-schedule (days of week + UTC time) and marks the state dirty for persistence.
|
/// Sets the weekly auto-schedule (days of week + UTC time) into the configuration and marks the state
|
||||||
/// Empty days disables auto-start (manual only).
|
/// dirty for persistence. Empty days disables auto-start (manual only). The configuration is the single
|
||||||
|
/// source of truth, so this is equivalent to editing the plugin config in the AdminPanel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="days">The days of week registration should auto-open.</param>
|
/// <param name="days">The days of week registration should auto-open.</param>
|
||||||
/// <param name="time">The UTC time of day registration should auto-open, or null to disable.</param>
|
/// <param name="time">The UTC time of day registration should auto-open, or null to disable.</param>
|
||||||
public void SetSchedule(IEnumerable<DayOfWeek> days, TimeOnly? time)
|
public void SetSchedule(IEnumerable<DayOfWeek> days, TimeOnly? time)
|
||||||
{
|
{
|
||||||
this._scheduleDays = days.Distinct().OrderBy(d => d).ToList();
|
var orderedDays = days.Distinct().OrderBy(d => d).ToList();
|
||||||
this._scheduleTime = this._scheduleDays.Count > 0 ? time : null;
|
this.Configuration.RegistrationOpenDays = orderedDays;
|
||||||
|
this.Configuration.RegistrationOpenTimes = orderedDays.Count > 0 && time is { } t
|
||||||
|
? new List<TimeOnly> { t }
|
||||||
|
: new List<TimeOnly>();
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns whether registration should auto-open now: a scheduled day matches and the current UTC time
|
|
||||||
/// falls within a 5-second window at/after the scheduled time. Only meaningful in the ownership phase.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="nowUtc">The current UTC time.</param>
|
|
||||||
public bool ShouldOpenRegistration(DateTime nowUtc)
|
|
||||||
{
|
|
||||||
if (this._scheduleTime is not { } scheduleTime || this._scheduleDays.Count == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this._scheduleDays.Contains(nowUtc.DayOfWeek))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var nowTime = TimeOnly.FromDateTime(nowUtc);
|
|
||||||
var windowEnd = scheduleTime.Add(TimeSpan.FromSeconds(5));
|
|
||||||
return scheduleTime <= nowTime && nowTime <= windowEnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns how much time is left in the running siege battle (the on-map countdown value), or
|
/// Returns how much time is left in the running siege battle (the on-map countdown value), or
|
||||||
/// <see cref="TimeSpan.Zero"/> when the siege is not currently running.
|
/// <see cref="TimeSpan.Zero"/> when the siege is not currently running.
|
||||||
@@ -228,9 +207,7 @@ public class CastleSiegeContext
|
|||||||
/// <param name="phase">The persisted phase.</param>
|
/// <param name="phase">The persisted phase.</param>
|
||||||
/// <param name="phaseStartedUtc">When the persisted phase started (UTC), or null to keep the default.</param>
|
/// <param name="phaseStartedUtc">When the persisted phase started (UTC), or null to keep the default.</param>
|
||||||
/// <param name="registeredGuilds">The persisted registered guild names, or null.</param>
|
/// <param name="registeredGuilds">The persisted registered guild names, or null.</param>
|
||||||
/// <param name="scheduleDays">The persisted auto-schedule days of week, or null.</param>
|
public void RestoreState(string? owner, CastleSiegePhase phase, DateTime? phaseStartedUtc, IEnumerable<string>? registeredGuilds)
|
||||||
/// <param name="scheduleTime">The persisted auto-schedule UTC time, or null.</param>
|
|
||||||
public void RestoreState(string? owner, CastleSiegePhase phase, DateTime? phaseStartedUtc, IEnumerable<string>? registeredGuilds, IEnumerable<DayOfWeek>? scheduleDays, TimeOnly? scheduleTime)
|
|
||||||
{
|
{
|
||||||
this.OwnerGuildName = owner;
|
this.OwnerGuildName = owner;
|
||||||
this.Phase = phase;
|
this.Phase = phase;
|
||||||
@@ -241,8 +218,6 @@ public class CastleSiegeContext
|
|||||||
this._registeredGuilds.AddRange(registeredGuilds);
|
this._registeredGuilds.AddRange(registeredGuilds);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._scheduleDays = scheduleDays?.Distinct().OrderBy(d => d).ToList() ?? new List<DayOfWeek>();
|
|
||||||
this._scheduleTime = this._scheduleDays.Count > 0 ? scheduleTime : null;
|
|
||||||
this._dirty = false;
|
this._dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,12 +88,15 @@ public class CastleSiegeScheduleChatCommandPlugIn : IChatCommandPlugIn
|
|||||||
|
|
||||||
private static string Describe(CastleSiegeContext context)
|
private static string Describe(CastleSiegeContext context)
|
||||||
{
|
{
|
||||||
if (context.ScheduleTime is not { } time || context.ScheduleDays.Count == 0)
|
var config = context.Configuration;
|
||||||
|
if (config.RegistrationOpenTimes.Count == 0)
|
||||||
{
|
{
|
||||||
return "Castle Siege auto-schedule: (none). Set with /csschedule <days> <HH:mm UTC>.";
|
return "Castle Siege auto-schedule: (none). Set with /csschedule <days> <HH:mm UTC>.";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $"Castle Siege auto-schedule: {string.Join(",", context.ScheduleDays)} at {time:HH:mm} UTC.";
|
var days = config.RegistrationOpenDays.Count > 0 ? string.Join(",", config.RegistrationOpenDays) : "every day";
|
||||||
|
var times = string.Join(",", config.RegistrationOpenTimes.Select(t => t.ToString("HH\\:mm")));
|
||||||
|
return $"Castle Siege auto-schedule: {days} at {times} UTC (reg {config.RegistrationDuration:g} -> prep {config.PreparationDuration:g} -> war {config.SiegeDuration:g}).";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ValueTask ShowAsync(Player player, string text)
|
private static ValueTask ShowAsync(Player player, string text)
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public sealed class CastleSiegeEventPlugIn : IPeriodicTaskPlugIn, ISupportCustom
|
|||||||
|
|
||||||
// Restore state persisted before the last restart (owner/phase/registrations) BEFORE subscribing,
|
// Restore state persisted before the last restart (owner/phase/registrations) BEFORE subscribing,
|
||||||
// so restoring doesn't announce phases or re-spawn defenses.
|
// so restoring doesn't announce phases or re-spawn defenses.
|
||||||
created.RestoreState(config.PersistedOwnerGuildName, config.PersistedPhase, config.PersistedPhaseStartedUtc, config.PersistedRegisteredGuilds, config.PersistedScheduleDays, config.PersistedScheduleTime);
|
created.RestoreState(config.PersistedOwnerGuildName, config.PersistedPhase, config.PersistedPhaseStartedUtc, config.PersistedRegisteredGuilds);
|
||||||
|
|
||||||
// Announce phase changes to the whole server and, when the siege begins, warp registered members.
|
// Announce phase changes to the whole server and, when the siege begins, warp registered members.
|
||||||
created.PhaseChanged += phase => _ = OnPhaseChangedAsync(gc, created, phase);
|
created.PhaseChanged += phase => _ = OnPhaseChangedAsync(gc, created, phase);
|
||||||
@@ -100,6 +100,12 @@ public sealed class CastleSiegeEventPlugIn : IPeriodicTaskPlugIn, ISupportCustom
|
|||||||
return created;
|
return created;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Point the context at the current (possibly AdminPanel-edited) config so schedule/durations are live.
|
||||||
|
if (this.Configuration is { } liveConfig)
|
||||||
|
{
|
||||||
|
context.UpdateConfiguration(liveConfig);
|
||||||
|
}
|
||||||
|
|
||||||
await context.TickAsync(DateTime.UtcNow).ConfigureAwait(false);
|
await context.TickAsync(DateTime.UtcNow).ConfigureAwait(false);
|
||||||
|
|
||||||
// During the siege, evaluate the Crown Switches (held by standing on them) and the throne capture every tick.
|
// During the siege, evaluate the Crown Switches (held by standing on them) and the throne capture every tick.
|
||||||
@@ -177,8 +183,6 @@ public sealed class CastleSiegeEventPlugIn : IPeriodicTaskPlugIn, ISupportCustom
|
|||||||
config.PersistedPhase = context.Phase;
|
config.PersistedPhase = context.Phase;
|
||||||
config.PersistedPhaseStartedUtc = context.PhaseStartedUtc;
|
config.PersistedPhaseStartedUtc = context.PhaseStartedUtc;
|
||||||
config.PersistedRegisteredGuilds = context.RegisteredGuilds.ToList();
|
config.PersistedRegisteredGuilds = context.RegisteredGuilds.ToList();
|
||||||
config.PersistedScheduleDays = context.ScheduleDays.ToList();
|
|
||||||
config.PersistedScheduleTime = context.ScheduleTime;
|
|
||||||
|
|
||||||
// Find our plugin-configuration row via the in-memory config graph to get its id.
|
// Find our plugin-configuration row via the in-memory config graph to get its id.
|
||||||
var pluginTypeId = typeof(CastleSiegeEventPlugIn).GUID;
|
var pluginTypeId = typeof(CastleSiegeEventPlugIn).GUID;
|
||||||
|
|||||||
@@ -131,34 +131,34 @@ public class CastleSiegeContextTest
|
|||||||
var phaseChangedFired = false;
|
var phaseChangedFired = false;
|
||||||
ctx.PhaseChanged += _ => phaseChangedFired = true;
|
ctx.PhaseChanged += _ => phaseChangedFired = true;
|
||||||
|
|
||||||
ctx.RestoreState("Winners", CastleSiegePhase.Ownership, T0, new[] { "Winners", "Losers" }, new[] { DayOfWeek.Sunday }, new TimeOnly(20, 0));
|
ctx.RestoreState("Winners", CastleSiegePhase.Ownership, T0, new[] { "Winners", "Losers" });
|
||||||
|
|
||||||
Assert.That(ctx.Phase, Is.EqualTo(CastleSiegePhase.Ownership));
|
Assert.That(ctx.Phase, Is.EqualTo(CastleSiegePhase.Ownership));
|
||||||
Assert.That(ctx.OwnerGuildName, Is.EqualTo("Winners"));
|
Assert.That(ctx.OwnerGuildName, Is.EqualTo("Winners"));
|
||||||
Assert.That(ctx.RegisteredGuilds, Is.EquivalentTo(new[] { "Winners", "Losers" }));
|
Assert.That(ctx.RegisteredGuilds, Is.EquivalentTo(new[] { "Winners", "Losers" }));
|
||||||
Assert.That(ctx.ScheduleDays, Is.EquivalentTo(new[] { DayOfWeek.Sunday }));
|
|
||||||
Assert.That(ctx.ScheduleTime, Is.EqualTo(new TimeOnly(20, 0)));
|
|
||||||
Assert.That(phaseChangedFired, Is.False);
|
Assert.That(phaseChangedFired, Is.False);
|
||||||
Assert.That(ctx.ConsumeDirty(), Is.False, "restore must not mark the state dirty");
|
Assert.That(ctx.ConsumeDirty(), Is.False, "restore must not mark the state dirty");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tests that the weekly auto-schedule only opens registration on a matching day within the time window.</summary>
|
/// <summary>Tests that the weekly auto-schedule (stored in config) only fires on a matching day/time window.</summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void ShouldOpenRegistrationMatchesDayAndTimeWindow()
|
public void ScheduleFiresOnMatchingDayAndTimeWindow()
|
||||||
{
|
{
|
||||||
var ctx = new CastleSiegeContext(Config());
|
var ctx = new CastleSiegeContext(Config());
|
||||||
ctx.SetSchedule(new[] { DayOfWeek.Sunday }, new TimeOnly(20, 0));
|
ctx.SetSchedule(new[] { DayOfWeek.Sunday }, new TimeOnly(20, 0));
|
||||||
|
var config = ctx.Configuration;
|
||||||
|
|
||||||
var sunday = new DateTime(2026, 1, 4, 20, 0, 2, DateTimeKind.Utc); // a Sunday, +2s into the window
|
var sunday = new DateTime(2026, 1, 4, 20, 0, 2, DateTimeKind.Utc); // a Sunday, +2s into the window
|
||||||
var sundayLate = new DateTime(2026, 1, 4, 20, 0, 30, DateTimeKind.Utc); // past the 5s window
|
var sundayLate = new DateTime(2026, 1, 4, 20, 0, 30, DateTimeKind.Utc); // past the 5s window
|
||||||
var monday = new DateTime(2026, 1, 5, 20, 0, 2, DateTimeKind.Utc); // wrong day
|
var monday = new DateTime(2026, 1, 5, 20, 0, 2, DateTimeKind.Utc); // wrong day
|
||||||
|
|
||||||
Assert.That(ctx.ShouldOpenRegistration(sunday), Is.True);
|
Assert.That(config.IsRegistrationOpenTime(sunday), Is.True);
|
||||||
Assert.That(ctx.ShouldOpenRegistration(sundayLate), Is.False);
|
Assert.That(config.IsRegistrationOpenTime(sundayLate), Is.False);
|
||||||
Assert.That(ctx.ShouldOpenRegistration(monday), Is.False);
|
Assert.That(config.IsRegistrationOpenTime(monday), Is.False);
|
||||||
|
Assert.That(ctx.ConsumeDirty(), Is.True, "SetSchedule marks the state dirty");
|
||||||
|
|
||||||
ctx.SetSchedule(Array.Empty<DayOfWeek>(), null); // cleared -> never opens
|
ctx.SetSchedule(Array.Empty<DayOfWeek>(), null); // cleared -> never opens
|
||||||
Assert.That(ctx.ShouldOpenRegistration(sunday), Is.False);
|
Assert.That(config.IsRegistrationOpenTime(sunday), Is.False);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Tests that state-changing operations flip the dirty flag, which ConsumeDirty reads-and-resets.</summary>
|
/// <summary>Tests that state-changing operations flip the dirty flag, which ConsumeDirty reads-and-resets.</summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user