Skip to content

Commit

Permalink
Merge pull request #171 from anoehre/master
Browse files Browse the repository at this point in the history
T4 Template Fix / EnglishWordsConverter directly.
  • Loading branch information
MehdiK committed Apr 10, 2014
2 parents e6f0946 + c842030 commit 3dea90e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
###In Development
- [#171](https://github.com/MehdiK/Humanizer/pull/171): T4-Template fix: Using EnglishNumberToWordsConverter instead of 'ToWords()' while dogfooding the template with the library.

[Commits](https://github.com/MehdiK/Humanizer/compare/v1.19.1...master)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ public interface IFormatter
string TimeSpanHumanize_Zero();
}

public class EnglishNumberToWordsConverter
{
public EnglishNumberToWordsConverter() { }
public string Convert(int number) { }
public string ConvertToOrdinal(int number) { }
}

public interface INumberToWordsConverter
{
string Convert(int number);
Expand Down
7 changes: 6 additions & 1 deletion src/Humanizer.Tests/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

namespace Humanizer.Tests
{
public class DateHumanizeTests
public class DateHumanizeTests : AmbientCulture
{
public DateHumanizeTests()
: base("en-US")
{
}

[Theory]
[InlineData(1, "one second ago")]
[InlineData(10, "10 seconds ago")]
Expand Down
7 changes: 6 additions & 1 deletion src/Humanizer.Tests/NumberToWordsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

namespace Humanizer.Tests
{
public class NumberToWordsTests
public class NumberToWordsTests : AmbientCulture
{
public NumberToWordsTests()
: base("en-US")
{
}

[InlineData(1, "one")]
[InlineData(10, "ten")]
[InlineData(11, "eleven")]
Expand Down
7 changes: 6 additions & 1 deletion src/Humanizer.Tests/ToQuantityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

namespace Humanizer.Tests
{
public class ToQuantityTests
public class ToQuantityTests : AmbientCulture
{
public ToQuantityTests()
: base("en-US")
{
}

[Theory]
[InlineData("case", 0, "0 cases")]
[InlineData("case", 1, "1 case")]
Expand Down
3 changes: 2 additions & 1 deletion src/Humanizer/FluentDate/In.SomeTimeFrom.tt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ namespace Humanizer
var month = "Month" + plural;
var year = "Year" + plural;

var converter= new Humanizer.Localisation.NumberToWords.EnglishNumberToWordsConverter();
#>
/// <summary>
/// </summary>
public static class <#= i.ToWords().Dehumanize() #>
public static class <#= converter.Convert(i).Dehumanize() #>
{
/// <summary>
/// <#= i #> seconds from now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Humanizer.Localisation.NumberToWords
{
internal class EnglishNumberToWordsConverter : INumberToWordsConverter
public class EnglishNumberToWordsConverter : INumberToWordsConverter
{
private static readonly string[] UnitsMap = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
private static readonly string[] TensMap = { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
Expand Down

0 comments on commit 3dea90e

Please sign in to comment.