35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
namespace TaxBaik.Application.Tests;
|
|
|
|
using TaxBaik.Web.Components.Admin.Shared;
|
|
using Xunit;
|
|
|
|
public class BusinessDayCalculatorTests
|
|
{
|
|
[Theory]
|
|
[InlineData(2026, 2, 14, 2026, 2, 19)]
|
|
[InlineData(2026, 8, 15, 2026, 8, 20)]
|
|
[InlineData(2026, 9, 24, 2026, 9, 29)]
|
|
[InlineData(2026, 10, 3, 2026, 10, 8)]
|
|
public void GetEffectiveDueDate_SkipsWeekendHolidayAndSubstituteHoliday(
|
|
int dueYear, int dueMonth, int dueDay,
|
|
int expectedYear, int expectedMonth, int expectedDay)
|
|
{
|
|
var effective = BusinessDayCalculator.GetEffectiveDueDate(new DateOnly(dueYear, dueMonth, dueDay));
|
|
|
|
Assert.Equal(new DateOnly(expectedYear, expectedMonth, expectedDay), effective);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(2026, 2, 19, 0)]
|
|
[InlineData(2026, 2, 20, -1)]
|
|
[InlineData(2026, 2, 18, 1)]
|
|
public void GetDday_UsesEffectiveDueDate(
|
|
int refYear, int refMonth, int refDay,
|
|
int expectedDays)
|
|
{
|
|
var dday = BusinessDayCalculator.GetDday(new DateOnly(2026, 2, 14), new DateOnly(refYear, refMonth, refDay));
|
|
|
|
Assert.Equal(expectedDays, dday);
|
|
}
|
|
}
|