Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiK committed Apr 12, 2014
1 parent 89cee88 commit f805476
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 43 deletions.
39 changes: 11 additions & 28 deletions src/Humanizer.Tests/Localisation/id/DateHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,32 @@ public class DateHumanizeTests : AmbientCulture
public DateHumanizeTests() : base("id-ID") { }

[Theory]
[InlineData(-1, "sedetik yang lalu")]
[InlineData(120, "2 menit yang lalu")]
[InlineData(90, "semenit yang lalu")]
[InlineData(1, "sedetik yang lalu")]
[InlineData(10, "10 detik yang lalu")]
public void SecondsAgo(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past);
}

[Theory]
[InlineData(1, "sedetik dari sekarang")]
[InlineData(60, "semenit dari sekarang")]
[InlineData(120, "2 menit dari sekarang")]
[InlineData(10, "10 detik dari sekarang")]
public void SecondsFromNow(int seconds, string expected)
{
DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future);
}

[Theory]
[InlineData(1, "semenit yang lalu")]
[InlineData(15, "15 menit yang lalu")]
[InlineData(45, "sejam yang lalu")]
[InlineData(150, "2 jam yang lalu")]
[InlineData(10, "10 menit yang lalu")]
public void MinutesAgo(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past);
}

[Theory]
[InlineData(1, "semenit dari sekarang")]
[InlineData(15, "15 menit dari sekarang")]
[InlineData(45, "sejam dari sekarang")]
[InlineData(150, "2 jam dari sekarang")]
[InlineData(10, "10 menit dari sekarang")]
public void MinutesFromNow(int minutes, string expected)
{
DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future);
Expand All @@ -48,8 +42,6 @@ public void MinutesFromNow(int minutes, string expected)
[Theory]
[InlineData(1, "sejam yang lalu")]
[InlineData(10, "10 jam yang lalu")]
[InlineData(24, "kemarin")]
[InlineData(48, "2 hari yang lalu")]
public void HoursAgo(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past);
Expand All @@ -58,17 +50,14 @@ public void HoursAgo(int hours, string expected)
[Theory]
[InlineData(1, "sejam dari sekarang")]
[InlineData(10, "10 jam dari sekarang")]
[InlineData(24, "besok")]
[InlineData(48, "2 hari dari sekarang")]
public void HoursFromNow(int hours, string expected)
{
DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future);
}

[Theory]
[InlineData(1, "kemarin")]
[InlineData(15, "15 hari yang lalu")]
[InlineData(38, "sebulan yang lalu")]
[InlineData(10, "10 hari yang lalu")]
public void DaysAgo(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past);
Expand All @@ -77,8 +66,6 @@ public void DaysAgo(int days, string expected)
[Theory]
[InlineData(1, "besok")]
[InlineData(10, "10 hari dari sekarang")]
[InlineData(32, "sebulan dari sekarang")]
[InlineData(80, "2 bulan dari sekarang")]
public void DaysFromNow(int days, string expected)
{
DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future);
Expand All @@ -87,34 +74,30 @@ public void DaysFromNow(int days, string expected)
[Theory]
[InlineData(1, "sebulan yang lalu")]
[InlineData(10, "10 bulan yang lalu")]
[InlineData(12, "setahun yang lalu")]
[InlineData(32, "2 tahun yang lalu")]
public void MonthsAgo(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past);
}

[Theory]
[InlineData(1, "sebulan dari sekarang")]
[InlineData(8, "8 bulan dari sekarang")]
[InlineData(12, "setahun dari sekarang")]
[InlineData(26, "2 tahun dari sekarang")]
[InlineData(10, "10 bulan dari sekarang")]
public void MonthsFromNow(int months, string expected)
{
DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future);
}

[Theory]
[InlineData(-1, "setahun yang lalu")]
[InlineData(-2, "2 tahun yang lalu")]
[InlineData(1, "setahun yang lalu")]
[InlineData(2, "2 tahun yang lalu")]
public void YearsAgo(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past);
}

[Theory]
[InlineData(-1, "setahun dari sekarang")]
[InlineData(-5, "5 tahun dari sekarang")]
[InlineData(1, "setahun dari sekarang")]
[InlineData(2, "2 tahun dari sekarang")]
public void YearsFromNow(int years, string expected)
{
DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future);
Expand Down
22 changes: 8 additions & 14 deletions src/Humanizer.Tests/Localisation/id/TimeSpanHumanizeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,44 @@ public class TimeSpanHumanizeTests : AmbientCulture
public TimeSpanHumanizeTests() : base("id-ID") { }

[Theory]
[InlineData(-7, "waktu kosong")]
[InlineData(14, "2 minggu")]
[InlineData(7, "1 minggu")]
[InlineData(21, "3 minggu")]
[InlineData(367, "52 minggu")]
public void Weeks(int days, string expected)
{
var actual = TimeSpan.FromDays(days).Humanize();
Assert.Equal(expected, actual);
}

[Theory]
[InlineData(3, "3 hari")]
[InlineData(8, "1 minggu")]
[InlineData(2, "2 hari")]
[InlineData(1, "1 hari")]
public void Days(int days, string expected)
{
var actual = TimeSpan.FromDays(days).Humanize();
Assert.Equal(expected, actual);
}

[Theory]
[InlineData(12, "12 jam")]
[InlineData(24, "1 hari")]
[InlineData(25, "1 hari")]
[InlineData(2, "2 jam")]
[InlineData(1, "1 jam")]
public void Hours(int hours, string expected)
{
var actual = TimeSpan.FromHours(hours).Humanize();
Assert.Equal(expected, actual);
}

[Theory]
[InlineData(2, "2 menit")]
[InlineData(1, "1 menit")]
[InlineData(60, "1 jam")]
[InlineData(120, "2 jam")]
public void Minutes(int minutes, string expected)
{
var actual = TimeSpan.FromMinutes(minutes).Humanize();
Assert.Equal(expected, actual);
}

[Theory]
[InlineData(2, "2 detik")]
[InlineData(1, "1 detik")]
[InlineData(60, "1 menit")]
[InlineData(150, "2 menit")]
public void Seconds(int seconds, string expected)
{
var actual = TimeSpan.FromSeconds(seconds).Humanize();
Expand All @@ -60,8 +55,7 @@ public void Seconds(int seconds, string expected)

[Theory]
[InlineData(2, "2 milidetik")]
[InlineData(2500, "2 detik")]
[InlineData(65000, "1 menit")]
[InlineData(1, "1 milidetik")]
public void Milliseconds(int ms, string expected)
{
var actual = TimeSpan.FromMilliseconds(ms).Humanize();
Expand Down
1 change: 0 additions & 1 deletion src/Humanizer/Humanizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
<EmbeddedResource Include="Properties\Resources.id.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.id.resx" />
<EmbeddedResource Include="Properties\Resources.pl.resx" />
<EmbeddedResource Include="Properties\Resources.cs.resx" />
<EmbeddedResource Include="Properties\Resources.de.resx" />
Expand Down

2 comments on commit f805476

@soeleman
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is correct. :)

@MehdiK
Copy link
Member Author

@MehdiK MehdiK commented on f805476 Apr 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe, cool. Thanks for the review.

Please sign in to comment.