-
Notifications
You must be signed in to change notification settings - Fork 965
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c98ce8
commit f2de33d
Showing
15 changed files
with
9,634 additions
and
4,326 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,44 @@ | ||
#if NET6_0_OR_GREATER | ||
|
||
using System; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.FluentDate | ||
{ | ||
public class InDateTests | ||
{ | ||
[Fact] | ||
public void InJanuary() | ||
{ | ||
Assert.Equal(new DateOnly(DateTime.Now.Year, 1, 1), InDate.January); | ||
} | ||
|
||
[Fact] | ||
public void InJanuaryOf2009() | ||
{ | ||
Assert.Equal(new DateOnly(2009, 1, 1), InDate.JanuaryOf(2009)); | ||
} | ||
|
||
[Fact] | ||
public void InFebruary() | ||
{ | ||
Assert.Equal(new DateOnly(DateTime.Now.Year, 2, 1), InDate.February); | ||
} | ||
|
||
[Fact] | ||
public void InTheYear() | ||
{ | ||
Assert.Equal(new DateOnly(2009, 1, 1), InDate.TheYear(2009)); | ||
} | ||
|
||
[Fact] | ||
public void InFiveDays() | ||
{ | ||
var baseDate = OnDate.January.The21st; | ||
var date = InDate.Five.DaysFrom(baseDate); | ||
Assert.Equal(baseDate.AddDays(5), date); | ||
} | ||
} | ||
} | ||
#endif | ||
|
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,30 @@ | ||
#if NET6_0_OR_GREATER | ||
|
||
using System; | ||
using Xunit; | ||
|
||
namespace Humanizer.Tests.FluentDate | ||
{ | ||
public class OnDateTests | ||
{ | ||
[Fact] | ||
public void OnJanuaryThe23rd() | ||
{ | ||
Assert.Equal(new DateOnly(DateTime.Now.Year, 1, 23), OnDate.January.The23rd); | ||
} | ||
|
||
[Fact] | ||
public void OnDecemberThe4th() | ||
{ | ||
Assert.Equal(new DateOnly(DateTime.Now.Year, 12, 4), OnDate.December.The4th); | ||
} | ||
|
||
[Fact] | ||
public void OnFebruaryThe() | ||
{ | ||
Assert.Equal(new DateOnly(DateTime.Now.Year, 2, 11), OnDate.February.The(11)); | ||
} | ||
} | ||
} | ||
|
||
#endif |
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
609 changes: 609 additions & 0 deletions
609
src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.approve_public_api.approved.txt
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,201 +1,201 @@ | ||
| ||
| ||
using System; | ||
|
||
namespace Humanizer | ||
{ | ||
public partial class In | ||
{ | ||
|
||
/// <summary> | ||
/// Returns 1st of January of the current year | ||
/// </summary> | ||
public static DateTime January | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 1, 1); } | ||
} | ||
public static DateTime January | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 1, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of January of the year passed in | ||
/// </summary> | ||
public static DateTime JanuaryOf(int year) | ||
{ | ||
return new DateTime(year, 1, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 1, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of February of the current year | ||
/// </summary> | ||
public static DateTime February | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 2, 1); } | ||
} | ||
public static DateTime February | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 2, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of February of the year passed in | ||
/// </summary> | ||
public static DateTime FebruaryOf(int year) | ||
{ | ||
return new DateTime(year, 2, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 2, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of March of the current year | ||
/// </summary> | ||
public static DateTime March | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 3, 1); } | ||
} | ||
public static DateTime March | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 3, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of March of the year passed in | ||
/// </summary> | ||
public static DateTime MarchOf(int year) | ||
{ | ||
return new DateTime(year, 3, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 3, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of April of the current year | ||
/// </summary> | ||
public static DateTime April | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 4, 1); } | ||
} | ||
public static DateTime April | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 4, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of April of the year passed in | ||
/// </summary> | ||
public static DateTime AprilOf(int year) | ||
{ | ||
return new DateTime(year, 4, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 4, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of May of the current year | ||
/// </summary> | ||
public static DateTime May | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 5, 1); } | ||
} | ||
public static DateTime May | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 5, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of May of the year passed in | ||
/// </summary> | ||
public static DateTime MayOf(int year) | ||
{ | ||
return new DateTime(year, 5, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 5, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of June of the current year | ||
/// </summary> | ||
public static DateTime June | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 6, 1); } | ||
} | ||
public static DateTime June | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 6, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of June of the year passed in | ||
/// </summary> | ||
public static DateTime JuneOf(int year) | ||
{ | ||
return new DateTime(year, 6, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 6, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of July of the current year | ||
/// </summary> | ||
public static DateTime July | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 7, 1); } | ||
} | ||
public static DateTime July | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 7, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of July of the year passed in | ||
/// </summary> | ||
public static DateTime JulyOf(int year) | ||
{ | ||
return new DateTime(year, 7, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 7, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of August of the current year | ||
/// </summary> | ||
public static DateTime August | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 8, 1); } | ||
} | ||
public static DateTime August | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 8, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of August of the year passed in | ||
/// </summary> | ||
public static DateTime AugustOf(int year) | ||
{ | ||
return new DateTime(year, 8, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 8, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of September of the current year | ||
/// </summary> | ||
public static DateTime September | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 9, 1); } | ||
} | ||
public static DateTime September | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 9, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of September of the year passed in | ||
/// </summary> | ||
public static DateTime SeptemberOf(int year) | ||
{ | ||
return new DateTime(year, 9, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 9, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of October of the current year | ||
/// </summary> | ||
public static DateTime October | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 10, 1); } | ||
} | ||
public static DateTime October | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 10, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of October of the year passed in | ||
/// </summary> | ||
public static DateTime OctoberOf(int year) | ||
{ | ||
return new DateTime(year, 10, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 10, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of November of the current year | ||
/// </summary> | ||
public static DateTime November | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 11, 1); } | ||
} | ||
public static DateTime November | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 11, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of November of the year passed in | ||
/// </summary> | ||
public static DateTime NovemberOf(int year) | ||
{ | ||
return new DateTime(year, 11, 1); | ||
} | ||
|
||
{ | ||
return new DateTime(year, 11, 1); | ||
} | ||
/// <summary> | ||
/// Returns 1st of December of the current year | ||
/// </summary> | ||
public static DateTime December | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 12, 1); } | ||
} | ||
public static DateTime December | ||
{ | ||
get { return new DateTime(DateTime.UtcNow.Year, 12, 1); } | ||
} | ||
|
||
/// <summary> | ||
/// Returns 1st of December of the year passed in | ||
/// </summary> | ||
public static DateTime DecemberOf(int year) | ||
{ | ||
return new DateTime(year, 12, 1); | ||
} | ||
} | ||
{ | ||
return new DateTime(year, 12, 1); | ||
} | ||
} | ||
} |
Oops, something went wrong.