Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unit tests #986

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Humanizer.Tests.Shared/ArticlePrefixSortTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public class ArticlePrefixSortTests
{
[Theory]
[InlineData(new[] { "Ant", "The Theater", "The apple", "Fox", "Bear" }, new[] { "Ant", "The apple", "Bear", "Fox", "The Theater" })]
[InlineData(new[] { "An Ant", "The Theater", "the apple", "a Fox", "Bear" }, new[] { "An Ant", "the apple", "Bear", "a Fox", "The Theater" })]
[InlineData(new[] { "Ant", "A Theater", "an apple", "Fox", "Bear" }, new[] { "Ant", "an apple", "Bear", "Fox", "A Theater" })]
public void SortStringArrayIgnoringArticlePrefixes(string[] input, string[] expectedOutput)
{
Assert.Equal(expectedOutput, EnglishArticle.PrependArticleSuffix(EnglishArticle.AppendArticlePrefix(input)));
Expand Down
126 changes: 126 additions & 0 deletions src/Humanizer.Tests.Shared/FluentDate/InTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,132 @@ public void InFebruary()
Assert.Equal(new DateTime(DateTime.Now.Year, 2, 1), In.February);
}

[Fact]
public void InFebruaryOf2009()
{
Assert.Equal(new DateTime(2009, 2, 1), In.FebruaryOf(2009));
}

[Fact]
public void InMarch()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 3, 1), In.March);
}

[Fact]
public void InMarchOf2009()
{
Assert.Equal(new DateTime(2009, 3, 1), In.MarchOf(2009));
}

[Fact]
public void InApril()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 4, 1), In.April);
}

[Fact]
public void InAprilOf2009()
{
Assert.Equal(new DateTime(2009, 4, 1), In.AprilOf(2009));
}

[Fact]
public void InMay()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 5, 1), In.May);
}

[Fact]
public void InMayOf2009()
{
Assert.Equal(new DateTime(2009, 5, 1), In.MayOf(2009));
}

[Fact]
public void InJune()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 6, 1), In.June);
}

[Fact]
public void InJuneOf2009()
{
Assert.Equal(new DateTime(2009, 6, 1), In.JuneOf(2009));
}

[Fact]
public void InJuly()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 7, 1), In.July);
}

[Fact]
public void InJulyOf2009()
{
Assert.Equal(new DateTime(2009, 7, 1), In.JulyOf(2009));
}

[Fact]
public void InAugust()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 8, 1), In.August);
}

[Fact]
public void InAugustOf2009()
{
Assert.Equal(new DateTime(2009, 8, 1), In.AugustOf(2009));
}

[Fact]
public void InSeptember()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 9, 1), In.September);
}

[Fact]
public void InSeptemberOf2009()
{
Assert.Equal(new DateTime(2009, 9, 1), In.SeptemberOf(2009));
}

[Fact]
public void InOctober()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 10, 1), In.October);
}

[Fact]
public void InOctoberOfIn2009()
{
Assert.Equal(new DateTime(2009, 10, 1), In.OctoberOf(2009));
}

[Fact]
public void InNovember()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 11, 1), In.November);
}

[Fact]
public void InNovemberOf2009()
{
Assert.Equal(new DateTime(2009, 11, 1), In.NovemberOf(2009));
}

[Fact]
public void InDecember()
{
Assert.Equal(new DateTime(DateTime.Now.Year, 12, 1), In.December);
}

[Fact]
public void InDecemberOf2009()
{
Assert.Equal(new DateTime(2009, 12, 1), In.DecemberOf(2009));
}

[Fact]
public void InTheYear()
{
Expand Down