From d4b9696a49ba6a22f8d2acf3568729da6b523f1d Mon Sep 17 00:00:00 2001 From: Theaux Masquelier <43664045+Theauxm@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:12:02 -0600 Subject: [PATCH] chore: add ScheduleOptions Enabled and Exclusion builder tests Verify Enabled(false), single/multiple Exclude(), and combined options flow through the inferred scheduling API without error. --- .../UnitTests/InferredSchedulingApiTests.cs | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/tests/Trax.Dashboard.Tests.Integration/UnitTests/InferredSchedulingApiTests.cs b/tests/Trax.Dashboard.Tests.Integration/UnitTests/InferredSchedulingApiTests.cs index 573e86a..55184b7 100644 --- a/tests/Trax.Dashboard.Tests.Integration/UnitTests/InferredSchedulingApiTests.cs +++ b/tests/Trax.Dashboard.Tests.Integration/UnitTests/InferredSchedulingApiTests.cs @@ -3,6 +3,7 @@ using Trax.Dashboard.Tests.Integration.Fakes.Trains; using Trax.Effect.Configuration.TraxBuilder; using Trax.Effect.Extensions; +using Trax.Effect.Models.Manifest; using Trax.Effect.Services.EffectRegistry; using Trax.Mediator.Configuration; using Trax.Mediator.Extensions; @@ -429,6 +430,100 @@ public void IncludeMany_WithDormantOption_Succeeds() #endregion + #region ScheduleOptions: Enabled and Exclusion + + [Test] + public void Schedule_WithEnabledFalse_Succeeds() + { + var act = () => + _parentBuilder.AddScheduler(scheduler => + scheduler.Schedule( + "job-disabled", + new FakeManifestInputA(), + Every.Minutes(5), + options => options.Enabled(false) + ) + ); + + act.Should().NotThrow(); + } + + [Test] + public void Schedule_WithExclusion_Succeeds() + { + var act = () => + _parentBuilder.AddScheduler(scheduler => + scheduler.Schedule( + "job-excluded", + new FakeManifestInputA(), + Every.Minutes(5), + options => + options.Exclude(Exclude.DaysOfWeek(DayOfWeek.Saturday, DayOfWeek.Sunday)) + ) + ); + + act.Should().NotThrow(); + } + + [Test] + public void Schedule_WithMultipleExclusions_Succeeds() + { + var act = () => + _parentBuilder.AddScheduler(scheduler => + scheduler.Schedule( + "job-multi-exclude", + new FakeManifestInputA(), + Every.Minutes(5), + options => + options + .Exclude(Exclude.DaysOfWeek(DayOfWeek.Saturday)) + .Exclude(Exclude.DaysOfWeek(DayOfWeek.Sunday)) + ) + ); + + act.Should().NotThrow(); + } + + [Test] + public void Include_WithEnabledFalse_Succeeds() + { + var act = () => + _parentBuilder.AddScheduler(scheduler => + scheduler + .Schedule( + "root", + new FakeManifestInputA(), + Every.Minutes(5) + ) + .Include( + "dep-disabled", + new FakeManifestInputB(), + options => options.Enabled(false) + ) + ); + + act.Should().NotThrow(); + } + + [Test] + public void Schedule_WithEnabledFalseAndExclusion_Succeeds() + { + var act = () => + _parentBuilder.AddScheduler(scheduler => + scheduler.Schedule( + "job-disabled-excluded", + new FakeManifestInputA(), + Every.Minutes(5), + options => + options.Enabled(false).Exclude(Exclude.DaysOfWeek(DayOfWeek.Saturday)) + ) + ); + + act.Should().NotThrow(); + } + + #endregion + #region Cycle detection with new API [Test]