1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:25:43 +00:00

test: add tests for GetIso8601WeekOfYear

This commit is contained in:
Oliver Booth 2023-03-30 20:44:32 +01:00
parent 006523d342
commit 628ead1ebb
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025
2 changed files with 54 additions and 0 deletions

View File

@ -37,6 +37,33 @@ public class DateTimeOffsetTests
Assert.AreEqual(new DateTime(today.Year, today.Month, 1), today.FirstDayOfMonth());
}
[TestMethod]
public void GetIso8601WeekOfYear_ShouldReturn1_Given4January1970()
{
DateTimeOffset date = new DateTime(1970, 1, 4);
int iso8601WeekOfYear = date.GetIso8601WeekOfYear();
Assert.AreEqual(1, iso8601WeekOfYear);
}
[TestMethod]
public void GetIso8601WeekOfYear_ShouldReturn1_Given31December1969()
{
DateTimeOffset date = new DateTime(1969, 12, 31);
int iso8601WeekOfYear = date.GetIso8601WeekOfYear();
Assert.AreEqual(1, iso8601WeekOfYear);
}
[TestMethod]
public void GetIso8601WeekOfYear_ShouldReturn53_Given31December1970()
{
DateTimeOffset date = new DateTime(1970, 12, 31);
int iso8601WeekOfYear = date.GetIso8601WeekOfYear();
Assert.AreEqual(53, iso8601WeekOfYear);
}
[TestMethod]
public void IsLeapYear_ShouldBeFalse_Given1999()
{

View File

@ -37,6 +37,33 @@ public class DateTimeTests
Assert.AreEqual(new DateTime(today.Year, today.Month, 1), today.FirstDayOfMonth());
}
[TestMethod]
public void GetIso8601WeekOfYear_ShouldReturn1_Given4January1970()
{
var date = new DateTime(1970, 1, 4);
int iso8601WeekOfYear = date.GetIso8601WeekOfYear();
Assert.AreEqual(1, iso8601WeekOfYear);
}
[TestMethod]
public void GetIso8601WeekOfYear_ShouldReturn1_Given31December1969()
{
var date = new DateTime(1969, 12, 31);
int iso8601WeekOfYear = date.GetIso8601WeekOfYear();
Assert.AreEqual(1, iso8601WeekOfYear);
}
[TestMethod]
public void GetIso8601WeekOfYear_ShouldReturn53_Given31December1970()
{
var date = new DateTime(1970, 12, 31);
int iso8601WeekOfYear = date.GetIso8601WeekOfYear();
Assert.AreEqual(53, iso8601WeekOfYear);
}
[TestMethod]
public void IsLeapYear_ShouldBeFalse_Given1999()
{