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]