summaryrefslogtreecommitdiff
path: root/tests/FundLab.Domain.Tests/DomainTests.fs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/FundLab.Domain.Tests/DomainTests.fs')
-rw-r--r--tests/FundLab.Domain.Tests/DomainTests.fs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/FundLab.Domain.Tests/DomainTests.fs b/tests/FundLab.Domain.Tests/DomainTests.fs
index 13be13f..42dd2a5 100644
--- a/tests/FundLab.Domain.Tests/DomainTests.fs
+++ b/tests/FundLab.Domain.Tests/DomainTests.fs
@@ -621,3 +621,25 @@ module SipPolicyTests =
Assert.Equal(Ok 200.00m, SipPolicy.executionNetAmount 200.00m)
Assert.Equal(Error "sip amount must be positive", SipPolicy.executionNetAmount 0m)
+
+ [<Fact>]
+ let ``advance plan enumerates due dates up to the end date`` () =
+ let anchor = d 2026 9 21
+
+ Assert.Equal<DateOnly list>(
+ [ d 2026 9 28; d 2026 10 5; d 2026 10 12 ],
+ SipPolicy.advancePlan Weekly anchor (d 2026 9 28) (d 2026 10 12)
+ )
+
+ Assert.Equal<DateOnly list>([ d 2026 9 28 ], SipPolicy.advancePlan Weekly anchor (d 2026 9 28) (d 2026 9 30))
+ Assert.Equal<DateOnly list>([], SipPolicy.advancePlan Weekly anchor (d 2026 10 5) (d 2026 9 30))
+
+ [<Fact>]
+ let ``advance plan never emits weekend dates`` () =
+ let anchor = d 2026 1 31
+
+ let dates = SipPolicy.advancePlan Monthly anchor (d 2026 2 2) (d 2026 5 31)
+
+ Assert.All(dates, fun (date: DateOnly) -> Assert.NotEqual(DayOfWeek.Saturday, date.DayOfWeek); Assert.NotEqual(DayOfWeek.Sunday, date.DayOfWeek))
+ Assert.Contains(d 2026 3 2, dates)
+ Assert.Equal(4, dates.Length)