Template
32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using FluentAssertions;
|
|
using NUnit.Framework;
|
|
using Strata.ContinuousImprovement.Biz.Utilities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using static Org.BouncyCastle.Math.EC.ECCurve;
|
|
|
|
namespace Strata.ContinuousImprovement.Biz.Test.Unit.UtilitiesTests
|
|
{
|
|
[TestFixture, Category("Unit")]
|
|
public class DateExtensionsTest
|
|
{
|
|
[TestCaseSource(nameof(GetStartOrEndDateOfYearPeriodCases))]
|
|
public void TestGetStartOrEndDateOfYearPeriod(DateTime dateSource, DateTime dateExpected, int yearDiff)
|
|
{
|
|
var dateActual = dateSource.GetStartOrEndDateOfYearPeriod(yearDiff);
|
|
dateActual.Should().Be(dateExpected);
|
|
}
|
|
|
|
public static IEnumerable<TestCaseData> GetStartOrEndDateOfYearPeriodCases()
|
|
{
|
|
yield return new TestCaseData(new DateTime(2024, 2, 29), new DateTime(2023, 3, 1), -1);
|
|
yield return new TestCaseData(new DateTime(2025, 2, 28), new DateTime(2024, 3, 1), -1);
|
|
yield return new TestCaseData(new DateTime(2023, 3, 1), new DateTime(2024, 2, 29), 1);
|
|
yield return new TestCaseData(new DateTime(2024, 3, 1), new DateTime(2025, 2, 28), 1);
|
|
}
|
|
}
|
|
}
|