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

Use English for the Invariant as would be expected. #850

Merged
merged 1 commit into from
Sep 6, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,38 @@ namespace Humanizer.Tests.Localisation.invariant
public class NumberToWordsTests
{

[InlineData(1, "one")]
[InlineData(10, "ten")]
[InlineData(11, "eleven")]
[InlineData(20, "twenty")]
[InlineData(122, "one hundred and twenty-two")]
[InlineData(3501, "three thousand five hundred and one")]
[InlineData(100, "one hundred")]
[InlineData(1000, "one thousand")]
[InlineData(100000, "one hundred thousand")]
[InlineData(1000000, "one million")]
[InlineData(10000000, "ten million")]
[InlineData(100000000, "one hundred million")]
[InlineData(1000000000, "one billion")]
[InlineData(111, "one hundred and eleven")]
[InlineData(1111, "one thousand one hundred and eleven")]
[InlineData(111111, "one hundred and eleven thousand one hundred and eleven")]
[InlineData(1111111, "one million one hundred and eleven thousand one hundred and eleven")]
[InlineData(11111111, "eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(111111111, "one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(1111111111, "one billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven")]
[InlineData(123, "one hundred and twenty-three")]
[InlineData(1234, "one thousand two hundred and thirty-four")]
[InlineData(12345, "twelve thousand three hundred and forty-five")]
[InlineData(123456, "one hundred and twenty-three thousand four hundred and fifty-six")]
[InlineData(1234567, "one million two hundred and thirty-four thousand five hundred and sixty-seven")]
[InlineData(12345678, "twelve million three hundred and forty-five thousand six hundred and seventy-eight")]
[InlineData(123456789, "one hundred and twenty-three million four hundred and fifty-six thousand seven hundred and eighty-nine")]
[InlineData(1234567890, "one billion two hundred and thirty-four million five hundred and sixty-seven thousand eight hundred and ninety")]
[Theory]
[InlineData(1)]
[InlineData(10)]
[InlineData(11)]
[InlineData(122)]
[InlineData(3501)]
[InlineData(100)]
[InlineData(1000)]
[InlineData(100000)]
[InlineData(1000000)]
[InlineData(10000000)]
[InlineData(100000000)]
[InlineData(1000000000)]
[InlineData(111)]
[InlineData(1111)]
[InlineData(111111)]
[InlineData(1111111)]
[InlineData(11111111)]
[InlineData(111111111)]
[InlineData(1111111111)]
[InlineData(123)]
[InlineData(1234)]
[InlineData(12345)]
[InlineData(123456)]
[InlineData(1234567)]
[InlineData(12345678)]
[InlineData(123456789)]
[InlineData(1234567890)]
public void ToWords(int number)
public void ToWordsInt(int number, string expected)
{
Assert.Equal(number.ToString(), number.ToWords());
Assert.Equal(expected, number.ToWords());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ public void ToQuantityNumeric(string word, int quantity, string expected)
}

[Theory]
[InlineData("case", 0, "0 cases")]
[InlineData("case", 1, "1 case")]
[InlineData("case", 5, "5 cases")]
[InlineData("man", 0, "0 men")]
[InlineData("man", 1, "1 man")]
[InlineData("man", 2, "2 men")]
[InlineData("men", 2, "2 men")]
[InlineData("process", 2, "2 processes")]
[InlineData("process", 1, "1 process")]
[InlineData("processes", 2, "2 processes")]
[InlineData("processes", 1200, "1200 processes")]
[InlineData("processes", 1, "1 process")]
[InlineData("case", 0, "zero cases")]
[InlineData("case", 1, "one case")]
[InlineData("case", 5, "five cases")]
[InlineData("man", 0, "zero men")]
[InlineData("man", 1, "one man")]
[InlineData("man", 2, "two men")]
[InlineData("men", 2, "two men")]
[InlineData("process", 2, "two processes")]
[InlineData("process", 1, "one process")]
[InlineData("processes", 2, "two processes")]
[InlineData("processes", 1200, "one thousand two hundred processes")]
[InlineData("processes", 1, "one process")]
public void ToQuantityWords(string word, int quantity, string expected)
{
Assert.Equal(expected, word.ToQuantity(quantity, ShowQuantityAs.Words));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Humanizer.Configuration
internal class NumberToWordsConverterRegistry : LocaliserRegistry<INumberToWordsConverter>
{
public NumberToWordsConverterRegistry()
: base((culture) => new DefaultNumberToWordsConverter(culture))
: base((culture) => new EnglishNumberToWordsConverter())
{
Register("af", new AfrikaansNumberToWordsConverter());
Register("en", new EnglishNumberToWordsConverter());
Expand Down