-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Australia - Fix Easter Sunday (#621)
- Loading branch information
Showing
2 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Linq; | ||
|
||
namespace Nager.Date.UnitTest.Countries | ||
{ | ||
[TestClass] | ||
public class AustraliaTest | ||
{ | ||
[TestMethod] | ||
public void TestEasterSunday2021() | ||
{ | ||
var year = 2021; | ||
var expectedSubdivisionCodes = new string[] { "AU-ACT", "AU-NSW", "AU-QLD", "AU-VIC" }; | ||
|
||
this.TestEasterSunday(year, expectedSubdivisionCodes); | ||
} | ||
|
||
[TestMethod] | ||
public void TestEasterSunday2022() | ||
{ | ||
var year = 2022; | ||
var expectedSubdivisionCodes = new string[] { "AU-ACT", "AU-NSW", "AU-QLD", "AU-VIC", "AU-WA" }; | ||
|
||
this.TestEasterSunday(year, expectedSubdivisionCodes); | ||
} | ||
|
||
[TestMethod] | ||
public void TestEasterSunday2023() | ||
{ | ||
var year = 2023; | ||
var expectedSubdivisionCodes = new string[] { "AU-ACT", "AU-NSW", "AU-NT", "AU-QLD", "AU-VIC", "AU-WA" }; | ||
|
||
this.TestEasterSunday(year, expectedSubdivisionCodes); | ||
} | ||
|
||
[TestMethod] | ||
public void TestEasterSunday2024() | ||
{ | ||
var year = 2024; | ||
var expectedSubdivisionCodes = new string[] { "AU-ACT", "AU-NSW", "AU-NT", "AU-QLD", "AU-SA", "AU-VIC", "AU-WA" }; | ||
|
||
this.TestEasterSunday(year, expectedSubdivisionCodes); | ||
} | ||
|
||
[TestMethod] | ||
public void TestEasterSunday2025() | ||
{ | ||
var year = 2025; | ||
var expectedSubdivisionCodes = new string[] { "AU-ACT", "AU-NSW", "AU-NT", "AU-QLD", "AU-SA", "AU-VIC", "AU-WA" }; | ||
|
||
this.TestEasterSunday(year, expectedSubdivisionCodes); | ||
} | ||
|
||
private void TestEasterSunday(int year, string[] expectedSubdivisionCodes) | ||
{ | ||
var englishName = "Easter Sunday"; | ||
|
||
var holidays = HolidaySystem.GetHolidays(year, CountryCode.AU); | ||
var easterSundayHoliday = holidays.FirstOrDefault(holiday => holiday.EnglishName == englishName); | ||
Assert.IsNotNull(easterSundayHoliday); | ||
CollectionAssert.AreEquivalent(expectedSubdivisionCodes, easterSundayHoliday.SubdivisionCodes); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters