From 31ce82bdaf6782f19e80869b49c7ec3b6d84e0f6 Mon Sep 17 00:00:00 2001 From: Yanos Date: Wed, 9 Apr 2014 21:54:21 +0200 Subject: [PATCH 1/6] Change test for non english system Force the culture to 'en' for running unit tests on a non-english computer. --- src/Humanizer.Tests/DateHumanizeTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Humanizer.Tests/DateHumanizeTests.cs b/src/Humanizer.Tests/DateHumanizeTests.cs index 1eb3b3d50..5ebe253d3 100644 --- a/src/Humanizer.Tests/DateHumanizeTests.cs +++ b/src/Humanizer.Tests/DateHumanizeTests.cs @@ -4,8 +4,10 @@ namespace Humanizer.Tests { - public class DateHumanizeTests + public class DateHumanizeTests : AmbientCulture { + public DateHumanizeTests() : base("en") { } + [Theory] [InlineData(1, "one second ago")] [InlineData(10, "10 seconds ago")] From 4075deb43fed9e80ee708ce05c8d398a5f0e51a4 Mon Sep 17 00:00:00 2001 From: Yanos Date: Wed, 9 Apr 2014 22:26:21 +0200 Subject: [PATCH 2/6] Update french and belgium french translations Add missing translations. Add DateHumanize and TimeSpanHumanize unit tests for 'fr' and 'fr-BE' culture. --- src/Humanizer.Tests/DateHumanizeTests.cs | 2 +- src/Humanizer.Tests/Humanizer.Tests.csproj | 4 + .../Localisation/fr-BE/DateHumanizeTests.cs | 130 ++++++++++++++++++ .../fr-BE/TimeSpanHumanizeTests.cs | 114 +++++++++++++++ .../Localisation/fr/DateHumanizeTests.cs | 130 ++++++++++++++++++ .../Localisation/fr/TimeSpanHumanizeTests.cs | 114 +++++++++++++++ src/Humanizer/Properties/Resources.fr-BE.resx | 80 ++++++++++- src/Humanizer/Properties/Resources.fr.resx | 80 ++++++++++- 8 files changed, 651 insertions(+), 3 deletions(-) create mode 100644 src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs create mode 100644 src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs create mode 100644 src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs create mode 100644 src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs diff --git a/src/Humanizer.Tests/DateHumanizeTests.cs b/src/Humanizer.Tests/DateHumanizeTests.cs index 5ebe253d3..ec139ac9e 100644 --- a/src/Humanizer.Tests/DateHumanizeTests.cs +++ b/src/Humanizer.Tests/DateHumanizeTests.cs @@ -6,7 +6,7 @@ namespace Humanizer.Tests { public class DateHumanizeTests : AmbientCulture { - public DateHumanizeTests() : base("en") { } + public DateHumanizeTests() : base("en-US") { } [Theory] [InlineData(1, "one second ago")] diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index bdfac012a..505fbf34e 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -80,6 +80,10 @@ + + + + diff --git a/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs new file mode 100644 index 000000000..9a4d17eb6 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs @@ -0,0 +1,130 @@ +using Humanizer.Localisation; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.frBE +{ + public class DateHumanizeTests : AmbientCulture + { + public DateHumanizeTests() : base("fr-BE") { } + + [Theory] + [InlineData(1, "il y a une seconde")] + [InlineData(10, "il y a 10 secondes")] + [InlineData(59, "il y a 59 secondes")] + [InlineData(60, "il y a une minute")] + public void SecondsAgo(int seconds, string expected) + { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une seconde")] + [InlineData(10, "dans 10 secondes")] + [InlineData(59, "dans 59 secondes")] + [InlineData(60, "dans une minute")] + public void SecondsFromNow(int seconds, string expected) + { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une minute")] + [InlineData(10, "il y a 10 minutes")] + [InlineData(44, "il y a 44 minutes")] + [InlineData(45, "il y a une heure")] + [InlineData(119, "il y a une heure")] + [InlineData(120, "il y a 2 heures")] + public void MinutesAgo(int minutes, string expected) + { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une minute")] + [InlineData(10, "dans 10 minutes")] + [InlineData(44, "dans 44 minutes")] + [InlineData(45, "dans une heure")] + [InlineData(119, "dans une heure")] + [InlineData(120, "dans 2 heures")] + public void MinutesFromNow(int minutes, string expected) + { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une heure")] + [InlineData(10, "il y a 10 heures")] + [InlineData(23, "il y a 23 heures")] + [InlineData(24, "hier")] + public void HoursAgo(int hours, string expected) + { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une heure")] + [InlineData(10, "dans 10 heures")] + [InlineData(23, "dans 23 heures")] + [InlineData(24, "demain")] + public void HoursFromNow(int hours, string expected) + { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); + } + + [Theory] + [InlineData(1, "hier")] + [InlineData(10, "il y a 10 jours")] + [InlineData(28, "il y a 28 jours")] + [InlineData(32, "il y a un mois")] + public void DaysAgo(int days, string expected) + { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); + } + + [Theory] + [InlineData(1, "demain")] + [InlineData(10, "dans 10 jours")] + [InlineData(28, "dans 28 jours")] + [InlineData(32, "dans un mois")] + public void DaysFromNow(int days, string expected) + { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un mois")] + [InlineData(10, "il y a 10 mois")] + [InlineData(11, "il y a 11 mois")] + [InlineData(12, "il y a un an")] + public void MonthsAgo(int months, string expected) + { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un mois")] + [InlineData(10, "dans 10 mois")] + [InlineData(11, "dans 11 mois")] + [InlineData(12, "dans un an")] + public void MonthsFromNow(int months, string expected) + { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un an")] + [InlineData(2, "il y a 2 ans")] + public void YearsAgo(int years, string expected) + { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un an")] + [InlineData(2, "dans 2 ans")] + public void YearsFromNow(int years, string expected) + { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); + } + } +} diff --git a/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs new file mode 100644 index 000000000..05c223de8 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs @@ -0,0 +1,114 @@ +using System; +using Xunit; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.frBE +{ + public class TimeSpanHumanizeTests : AmbientCulture + { + public TimeSpanHumanizeTests() : base("fr-BE") { } + + [Theory] + [InlineData(14, "2 semaines")] + [InlineData(7, "1 semaine")] + public void Weeks(int days, string expected) + { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(6, "6 jours")] + [InlineData(2, "2 jours")] + [InlineData(1, "1 jour")] + public void Days(int days, string expected) + { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 heures")] + [InlineData(1, "1 heure")] + public void Hours(int hours, string expected) + { + var actual = TimeSpan.FromHours(hours).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 minutes")] + [InlineData(1, "1 minute")] + public void Minutes(int minutes, string expected) + { + var actual = TimeSpan.FromMinutes(minutes).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(135, "2 minutes")] + [InlineData(60, "1 minute")] + [InlineData(2, "2 secondes")] + [InlineData(1, "1 seconde")] + public void Seconds(int seconds, string expected) + { + var actual = TimeSpan.FromSeconds(seconds).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2500, "2 secondes")] + [InlineData(1400, "1 seconde")] + [InlineData(2, "2 millisecondes")] + [InlineData(1, "1 milliseconde")] + public void Milliseconds(int ms, string expected) + { + var actual = TimeSpan.FromMilliseconds(ms).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(0, 3, "pas de temps")] + [InlineData(0, 2, "pas de temps")] + [InlineData(10, 2, "10 millisecondes")] + [InlineData(1400, 2, "1 seconde, 400 millisecondes")] + [InlineData(2500, 2, "2 secondes, 500 millisecondes")] + [InlineData(120000, 2, "2 minutes")] + [InlineData(62000, 2, "1 minute, 2 secondes")] + [InlineData(62020, 2, "1 minute, 2 secondes")] + [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] + [InlineData(3600020, 4, "1 heure, 20 millisecondes")] + [InlineData(3600020, 3, "1 heure, 20 millisecondes")] + [InlineData(3600020, 2, "1 heure, 20 millisecondes")] + [InlineData(3600020, 1, "1 heure")] + [InlineData(3603001, 2, "1 heure, 3 secondes")] + [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] + [InlineData(86400000, 3, "1 jour")] + [InlineData(86400000, 2, "1 jour")] + [InlineData(86400000, 1, "1 jour")] + [InlineData(86401000, 1, "1 jour")] + [InlineData(86401000, 2, "1 jour, 1 seconde")] + [InlineData(86401200, 2, "1 jour, 1 seconde")] + [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] + [InlineData(1296000000, 1, "2 semaines")] + [InlineData(1296000000, 2, "2 semaines, 1 jour")] + [InlineData(1299600000, 2, "2 semaines, 1 jour")] + [InlineData(1299600000, 3, "2 semaines, 1 jour, 1 heure")] + [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] + [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] + [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] + public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) + { + var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); + Assert.Equal(expected, actual); + } + + [Fact] + public void NoTime() + { + var noTime = TimeSpan.Zero; + var actual = noTime.Humanize(); + Assert.Equal("pas de temps", actual); + } + } +} diff --git a/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs new file mode 100644 index 000000000..b02cdfe21 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs @@ -0,0 +1,130 @@ +using Humanizer.Localisation; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.fr +{ + public class DateHumanizeTests : AmbientCulture + { + public DateHumanizeTests() : base("fr") { } + + [Theory] + [InlineData(1, "il y a une seconde")] + [InlineData(10, "il y a 10 secondes")] + [InlineData(59, "il y a 59 secondes")] + [InlineData(60, "il y a une minute")] + public void SecondsAgo(int seconds, string expected) + { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une seconde")] + [InlineData(10, "dans 10 secondes")] + [InlineData(59, "dans 59 secondes")] + [InlineData(60, "dans une minute")] + public void SecondsFromNow(int seconds, string expected) + { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une minute")] + [InlineData(10, "il y a 10 minutes")] + [InlineData(44, "il y a 44 minutes")] + [InlineData(45, "il y a une heure")] + [InlineData(119, "il y a une heure")] + [InlineData(120, "il y a 2 heures")] + public void MinutesAgo(int minutes, string expected) + { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une minute")] + [InlineData(10, "dans 10 minutes")] + [InlineData(44, "dans 44 minutes")] + [InlineData(45, "dans une heure")] + [InlineData(119, "dans une heure")] + [InlineData(120, "dans 2 heures")] + public void MinutesFromNow(int minutes, string expected) + { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une heure")] + [InlineData(10, "il y a 10 heures")] + [InlineData(23, "il y a 23 heures")] + [InlineData(24, "hier")] + public void HoursAgo(int hours, string expected) + { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une heure")] + [InlineData(10, "dans 10 heures")] + [InlineData(23, "dans 23 heures")] + [InlineData(24, "demain")] + public void HoursFromNow(int hours, string expected) + { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); + } + + [Theory] + [InlineData(1, "hier")] + [InlineData(10, "il y a 10 jours")] + [InlineData(28, "il y a 28 jours")] + [InlineData(32, "il y a un mois")] + public void DaysAgo(int days, string expected) + { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); + } + + [Theory] + [InlineData(1, "demain")] + [InlineData(10, "dans 10 jours")] + [InlineData(28, "dans 28 jours")] + [InlineData(32, "dans un mois")] + public void DaysFromNow(int days, string expected) + { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un mois")] + [InlineData(10, "il y a 10 mois")] + [InlineData(11, "il y a 11 mois")] + [InlineData(12, "il y a un an")] + public void MonthsAgo(int months, string expected) + { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un mois")] + [InlineData(10, "dans 10 mois")] + [InlineData(11, "dans 11 mois")] + [InlineData(12, "dans un an")] + public void MonthsFromNow(int months, string expected) + { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un an")] + [InlineData(2, "il y a 2 ans")] + public void YearsAgo(int years, string expected) + { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un an")] + [InlineData(2, "dans 2 ans")] + public void YearsFromNow(int years, string expected) + { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); + } + } +} diff --git a/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs new file mode 100644 index 000000000..eb3064018 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs @@ -0,0 +1,114 @@ +using System; +using Xunit; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.fr +{ + public class TimeSpanHumanizeTests : AmbientCulture + { + public TimeSpanHumanizeTests() : base("fr") { } + + [Theory] + [InlineData(14, "2 semaines")] + [InlineData(7, "1 semaine")] + public void Weeks(int days, string expected) + { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(6, "6 jours")] + [InlineData(2, "2 jours")] + [InlineData(1, "1 jour")] + public void Days(int days, string expected) + { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 heures")] + [InlineData(1, "1 heure")] + public void Hours(int hours, string expected) + { + var actual = TimeSpan.FromHours(hours).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 minutes")] + [InlineData(1, "1 minute")] + public void Minutes(int minutes, string expected) + { + var actual = TimeSpan.FromMinutes(minutes).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(135, "2 minutes")] + [InlineData(60, "1 minute")] + [InlineData(2, "2 secondes")] + [InlineData(1, "1 seconde")] + public void Seconds(int seconds, string expected) + { + var actual = TimeSpan.FromSeconds(seconds).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2500, "2 secondes")] + [InlineData(1400, "1 seconde")] + [InlineData(2, "2 millisecondes")] + [InlineData(1, "1 milliseconde")] + public void Milliseconds(int ms, string expected) + { + var actual = TimeSpan.FromMilliseconds(ms).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(0, 3, "pas de temps")] + [InlineData(0, 2, "pas de temps")] + [InlineData(10, 2, "10 millisecondes")] + [InlineData(1400, 2, "1 seconde, 400 millisecondes")] + [InlineData(2500, 2, "2 secondes, 500 millisecondes")] + [InlineData(120000, 2, "2 minutes")] + [InlineData(62000, 2, "1 minute, 2 secondes")] + [InlineData(62020, 2, "1 minute, 2 secondes")] + [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] + [InlineData(3600020, 4, "1 heure, 20 millisecondes")] + [InlineData(3600020, 3, "1 heure, 20 millisecondes")] + [InlineData(3600020, 2, "1 heure, 20 millisecondes")] + [InlineData(3600020, 1, "1 heure")] + [InlineData(3603001, 2, "1 heure, 3 secondes")] + [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] + [InlineData(86400000, 3, "1 jour")] + [InlineData(86400000, 2, "1 jour")] + [InlineData(86400000, 1, "1 jour")] + [InlineData(86401000, 1, "1 jour")] + [InlineData(86401000, 2, "1 jour, 1 seconde")] + [InlineData(86401200, 2, "1 jour, 1 seconde")] + [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] + [InlineData(1296000000, 1, "2 semaines")] + [InlineData(1296000000, 2, "2 semaines, 1 jour")] + [InlineData(1299600000, 2, "2 semaines, 1 jour")] + [InlineData(1299600000, 3, "2 semaines, 1 jour, 1 heure")] + [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] + [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] + [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] + public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) + { + var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); + Assert.Equal(expected, actual); + } + + [Fact] + public void NoTime() + { + var noTime = TimeSpan.Zero; + var actual = noTime.Humanize(); + Assert.Equal("pas de temps", actual); + } + } +} diff --git a/src/Humanizer/Properties/Resources.fr-BE.resx b/src/Humanizer/Properties/Resources.fr-BE.resx index c7ab8b23f..0a46359ab 100644 --- a/src/Humanizer/Properties/Resources.fr-BE.resx +++ b/src/Humanizer/Properties/Resources.fr-BE.resx @@ -151,6 +151,84 @@ il y a un an - il y a {0} années + il y a {0} ans + + + dans {0} jours + + + dans {0} heures + + + dans {0} minutes + + + dans {0} mois + + + dans {0} secondes + + + dans {0} ans + + + maintenant + + + demain + + + dans une heure + + + dans une minute + + + dans un mois + + + dans une seconde + + + dans un an + + + {0} jours + + + {0} heures + + + {0} millisecondes + + + {0} minutes + + + {0} secondes + + + {0} semaines + + + 1 jour + + + 1 heure + + + 1 milliseconde + + + 1 minute + + + 1 seconde + + + 1 semaine + + + pas de temps \ No newline at end of file diff --git a/src/Humanizer/Properties/Resources.fr.resx b/src/Humanizer/Properties/Resources.fr.resx index c7ab8b23f..0a46359ab 100644 --- a/src/Humanizer/Properties/Resources.fr.resx +++ b/src/Humanizer/Properties/Resources.fr.resx @@ -151,6 +151,84 @@ il y a un an - il y a {0} années + il y a {0} ans + + + dans {0} jours + + + dans {0} heures + + + dans {0} minutes + + + dans {0} mois + + + dans {0} secondes + + + dans {0} ans + + + maintenant + + + demain + + + dans une heure + + + dans une minute + + + dans un mois + + + dans une seconde + + + dans un an + + + {0} jours + + + {0} heures + + + {0} millisecondes + + + {0} minutes + + + {0} secondes + + + {0} semaines + + + 1 jour + + + 1 heure + + + 1 milliseconde + + + 1 minute + + + 1 seconde + + + 1 semaine + + + pas de temps \ No newline at end of file From 95613213e5511e72cf242fabf7ed339556b2fa42 Mon Sep 17 00:00:00 2001 From: Yanos Date: Thu, 10 Apr 2014 15:09:26 +0200 Subject: [PATCH 3/6] Remove redundants test cases --- src/Humanizer.Tests/Humanizer.Tests.csproj | 4 - .../Localisation/fr-BE/DateHumanizeTests.cs | 130 ------------------ .../fr-BE/TimeSpanHumanizeTests.cs | 114 --------------- .../Localisation/fr/DateHumanizeTests.cs | 130 ------------------ .../Localisation/fr/TimeSpanHumanizeTests.cs | 114 --------------- 5 files changed, 492 deletions(-) delete mode 100644 src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs delete mode 100644 src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs delete mode 100644 src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs delete mode 100644 src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index 505fbf34e..bdfac012a 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -80,10 +80,6 @@ - - - - diff --git a/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs deleted file mode 100644 index 9a4d17eb6..000000000 --- a/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs +++ /dev/null @@ -1,130 +0,0 @@ -using Humanizer.Localisation; -using Xunit.Extensions; - -namespace Humanizer.Tests.Localisation.frBE -{ - public class DateHumanizeTests : AmbientCulture - { - public DateHumanizeTests() : base("fr-BE") { } - - [Theory] - [InlineData(1, "il y a une seconde")] - [InlineData(10, "il y a 10 secondes")] - [InlineData(59, "il y a 59 secondes")] - [InlineData(60, "il y a une minute")] - public void SecondsAgo(int seconds, string expected) - { - DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); - } - - [Theory] - [InlineData(1, "dans une seconde")] - [InlineData(10, "dans 10 secondes")] - [InlineData(59, "dans 59 secondes")] - [InlineData(60, "dans une minute")] - public void SecondsFromNow(int seconds, string expected) - { - DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a une minute")] - [InlineData(10, "il y a 10 minutes")] - [InlineData(44, "il y a 44 minutes")] - [InlineData(45, "il y a une heure")] - [InlineData(119, "il y a une heure")] - [InlineData(120, "il y a 2 heures")] - public void MinutesAgo(int minutes, string expected) - { - DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); - } - - [Theory] - [InlineData(1, "dans une minute")] - [InlineData(10, "dans 10 minutes")] - [InlineData(44, "dans 44 minutes")] - [InlineData(45, "dans une heure")] - [InlineData(119, "dans une heure")] - [InlineData(120, "dans 2 heures")] - public void MinutesFromNow(int minutes, string expected) - { - DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a une heure")] - [InlineData(10, "il y a 10 heures")] - [InlineData(23, "il y a 23 heures")] - [InlineData(24, "hier")] - public void HoursAgo(int hours, string expected) - { - DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); - } - - [Theory] - [InlineData(1, "dans une heure")] - [InlineData(10, "dans 10 heures")] - [InlineData(23, "dans 23 heures")] - [InlineData(24, "demain")] - public void HoursFromNow(int hours, string expected) - { - DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); - } - - [Theory] - [InlineData(1, "hier")] - [InlineData(10, "il y a 10 jours")] - [InlineData(28, "il y a 28 jours")] - [InlineData(32, "il y a un mois")] - public void DaysAgo(int days, string expected) - { - DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); - } - - [Theory] - [InlineData(1, "demain")] - [InlineData(10, "dans 10 jours")] - [InlineData(28, "dans 28 jours")] - [InlineData(32, "dans un mois")] - public void DaysFromNow(int days, string expected) - { - DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a un mois")] - [InlineData(10, "il y a 10 mois")] - [InlineData(11, "il y a 11 mois")] - [InlineData(12, "il y a un an")] - public void MonthsAgo(int months, string expected) - { - DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); - } - - [Theory] - [InlineData(1, "dans un mois")] - [InlineData(10, "dans 10 mois")] - [InlineData(11, "dans 11 mois")] - [InlineData(12, "dans un an")] - public void MonthsFromNow(int months, string expected) - { - DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a un an")] - [InlineData(2, "il y a 2 ans")] - public void YearsAgo(int years, string expected) - { - DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); - } - - [Theory] - [InlineData(1, "dans un an")] - [InlineData(2, "dans 2 ans")] - public void YearsFromNow(int years, string expected) - { - DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); - } - } -} diff --git a/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs deleted file mode 100644 index 05c223de8..000000000 --- a/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using Xunit; -using Xunit.Extensions; - -namespace Humanizer.Tests.Localisation.frBE -{ - public class TimeSpanHumanizeTests : AmbientCulture - { - public TimeSpanHumanizeTests() : base("fr-BE") { } - - [Theory] - [InlineData(14, "2 semaines")] - [InlineData(7, "1 semaine")] - public void Weeks(int days, string expected) - { - var actual = TimeSpan.FromDays(days).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(6, "6 jours")] - [InlineData(2, "2 jours")] - [InlineData(1, "1 jour")] - public void Days(int days, string expected) - { - var actual = TimeSpan.FromDays(days).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(2, "2 heures")] - [InlineData(1, "1 heure")] - public void Hours(int hours, string expected) - { - var actual = TimeSpan.FromHours(hours).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(2, "2 minutes")] - [InlineData(1, "1 minute")] - public void Minutes(int minutes, string expected) - { - var actual = TimeSpan.FromMinutes(minutes).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(135, "2 minutes")] - [InlineData(60, "1 minute")] - [InlineData(2, "2 secondes")] - [InlineData(1, "1 seconde")] - public void Seconds(int seconds, string expected) - { - var actual = TimeSpan.FromSeconds(seconds).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(2500, "2 secondes")] - [InlineData(1400, "1 seconde")] - [InlineData(2, "2 millisecondes")] - [InlineData(1, "1 milliseconde")] - public void Milliseconds(int ms, string expected) - { - var actual = TimeSpan.FromMilliseconds(ms).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(0, 3, "pas de temps")] - [InlineData(0, 2, "pas de temps")] - [InlineData(10, 2, "10 millisecondes")] - [InlineData(1400, 2, "1 seconde, 400 millisecondes")] - [InlineData(2500, 2, "2 secondes, 500 millisecondes")] - [InlineData(120000, 2, "2 minutes")] - [InlineData(62000, 2, "1 minute, 2 secondes")] - [InlineData(62020, 2, "1 minute, 2 secondes")] - [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] - [InlineData(3600020, 4, "1 heure, 20 millisecondes")] - [InlineData(3600020, 3, "1 heure, 20 millisecondes")] - [InlineData(3600020, 2, "1 heure, 20 millisecondes")] - [InlineData(3600020, 1, "1 heure")] - [InlineData(3603001, 2, "1 heure, 3 secondes")] - [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] - [InlineData(86400000, 3, "1 jour")] - [InlineData(86400000, 2, "1 jour")] - [InlineData(86400000, 1, "1 jour")] - [InlineData(86401000, 1, "1 jour")] - [InlineData(86401000, 2, "1 jour, 1 seconde")] - [InlineData(86401200, 2, "1 jour, 1 seconde")] - [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] - [InlineData(1296000000, 1, "2 semaines")] - [InlineData(1296000000, 2, "2 semaines, 1 jour")] - [InlineData(1299600000, 2, "2 semaines, 1 jour")] - [InlineData(1299600000, 3, "2 semaines, 1 jour, 1 heure")] - [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] - [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] - [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] - public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) - { - var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); - Assert.Equal(expected, actual); - } - - [Fact] - public void NoTime() - { - var noTime = TimeSpan.Zero; - var actual = noTime.Humanize(); - Assert.Equal("pas de temps", actual); - } - } -} diff --git a/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs deleted file mode 100644 index b02cdfe21..000000000 --- a/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs +++ /dev/null @@ -1,130 +0,0 @@ -using Humanizer.Localisation; -using Xunit.Extensions; - -namespace Humanizer.Tests.Localisation.fr -{ - public class DateHumanizeTests : AmbientCulture - { - public DateHumanizeTests() : base("fr") { } - - [Theory] - [InlineData(1, "il y a une seconde")] - [InlineData(10, "il y a 10 secondes")] - [InlineData(59, "il y a 59 secondes")] - [InlineData(60, "il y a une minute")] - public void SecondsAgo(int seconds, string expected) - { - DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); - } - - [Theory] - [InlineData(1, "dans une seconde")] - [InlineData(10, "dans 10 secondes")] - [InlineData(59, "dans 59 secondes")] - [InlineData(60, "dans une minute")] - public void SecondsFromNow(int seconds, string expected) - { - DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a une minute")] - [InlineData(10, "il y a 10 minutes")] - [InlineData(44, "il y a 44 minutes")] - [InlineData(45, "il y a une heure")] - [InlineData(119, "il y a une heure")] - [InlineData(120, "il y a 2 heures")] - public void MinutesAgo(int minutes, string expected) - { - DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); - } - - [Theory] - [InlineData(1, "dans une minute")] - [InlineData(10, "dans 10 minutes")] - [InlineData(44, "dans 44 minutes")] - [InlineData(45, "dans une heure")] - [InlineData(119, "dans une heure")] - [InlineData(120, "dans 2 heures")] - public void MinutesFromNow(int minutes, string expected) - { - DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a une heure")] - [InlineData(10, "il y a 10 heures")] - [InlineData(23, "il y a 23 heures")] - [InlineData(24, "hier")] - public void HoursAgo(int hours, string expected) - { - DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); - } - - [Theory] - [InlineData(1, "dans une heure")] - [InlineData(10, "dans 10 heures")] - [InlineData(23, "dans 23 heures")] - [InlineData(24, "demain")] - public void HoursFromNow(int hours, string expected) - { - DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); - } - - [Theory] - [InlineData(1, "hier")] - [InlineData(10, "il y a 10 jours")] - [InlineData(28, "il y a 28 jours")] - [InlineData(32, "il y a un mois")] - public void DaysAgo(int days, string expected) - { - DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); - } - - [Theory] - [InlineData(1, "demain")] - [InlineData(10, "dans 10 jours")] - [InlineData(28, "dans 28 jours")] - [InlineData(32, "dans un mois")] - public void DaysFromNow(int days, string expected) - { - DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a un mois")] - [InlineData(10, "il y a 10 mois")] - [InlineData(11, "il y a 11 mois")] - [InlineData(12, "il y a un an")] - public void MonthsAgo(int months, string expected) - { - DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); - } - - [Theory] - [InlineData(1, "dans un mois")] - [InlineData(10, "dans 10 mois")] - [InlineData(11, "dans 11 mois")] - [InlineData(12, "dans un an")] - public void MonthsFromNow(int months, string expected) - { - DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); - } - - [Theory] - [InlineData(1, "il y a un an")] - [InlineData(2, "il y a 2 ans")] - public void YearsAgo(int years, string expected) - { - DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); - } - - [Theory] - [InlineData(1, "dans un an")] - [InlineData(2, "dans 2 ans")] - public void YearsFromNow(int years, string expected) - { - DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); - } - } -} diff --git a/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs deleted file mode 100644 index eb3064018..000000000 --- a/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using Xunit; -using Xunit.Extensions; - -namespace Humanizer.Tests.Localisation.fr -{ - public class TimeSpanHumanizeTests : AmbientCulture - { - public TimeSpanHumanizeTests() : base("fr") { } - - [Theory] - [InlineData(14, "2 semaines")] - [InlineData(7, "1 semaine")] - public void Weeks(int days, string expected) - { - var actual = TimeSpan.FromDays(days).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(6, "6 jours")] - [InlineData(2, "2 jours")] - [InlineData(1, "1 jour")] - public void Days(int days, string expected) - { - var actual = TimeSpan.FromDays(days).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(2, "2 heures")] - [InlineData(1, "1 heure")] - public void Hours(int hours, string expected) - { - var actual = TimeSpan.FromHours(hours).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(2, "2 minutes")] - [InlineData(1, "1 minute")] - public void Minutes(int minutes, string expected) - { - var actual = TimeSpan.FromMinutes(minutes).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(135, "2 minutes")] - [InlineData(60, "1 minute")] - [InlineData(2, "2 secondes")] - [InlineData(1, "1 seconde")] - public void Seconds(int seconds, string expected) - { - var actual = TimeSpan.FromSeconds(seconds).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(2500, "2 secondes")] - [InlineData(1400, "1 seconde")] - [InlineData(2, "2 millisecondes")] - [InlineData(1, "1 milliseconde")] - public void Milliseconds(int ms, string expected) - { - var actual = TimeSpan.FromMilliseconds(ms).Humanize(); - Assert.Equal(expected, actual); - } - - [Theory] - [InlineData(0, 3, "pas de temps")] - [InlineData(0, 2, "pas de temps")] - [InlineData(10, 2, "10 millisecondes")] - [InlineData(1400, 2, "1 seconde, 400 millisecondes")] - [InlineData(2500, 2, "2 secondes, 500 millisecondes")] - [InlineData(120000, 2, "2 minutes")] - [InlineData(62000, 2, "1 minute, 2 secondes")] - [InlineData(62020, 2, "1 minute, 2 secondes")] - [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] - [InlineData(3600020, 4, "1 heure, 20 millisecondes")] - [InlineData(3600020, 3, "1 heure, 20 millisecondes")] - [InlineData(3600020, 2, "1 heure, 20 millisecondes")] - [InlineData(3600020, 1, "1 heure")] - [InlineData(3603001, 2, "1 heure, 3 secondes")] - [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] - [InlineData(86400000, 3, "1 jour")] - [InlineData(86400000, 2, "1 jour")] - [InlineData(86400000, 1, "1 jour")] - [InlineData(86401000, 1, "1 jour")] - [InlineData(86401000, 2, "1 jour, 1 seconde")] - [InlineData(86401200, 2, "1 jour, 1 seconde")] - [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] - [InlineData(1296000000, 1, "2 semaines")] - [InlineData(1296000000, 2, "2 semaines, 1 jour")] - [InlineData(1299600000, 2, "2 semaines, 1 jour")] - [InlineData(1299600000, 3, "2 semaines, 1 jour, 1 heure")] - [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] - [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] - [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] - public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) - { - var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); - Assert.Equal(expected, actual); - } - - [Fact] - public void NoTime() - { - var noTime = TimeSpan.Zero; - var actual = noTime.Humanize(); - Assert.Equal("pas de temps", actual); - } - } -} From e94771c4de94550965665fd98b1eb9bff948c6f5 Mon Sep 17 00:00:00 2001 From: Yanos Date: Thu, 10 Apr 2014 15:27:32 +0200 Subject: [PATCH 4/6] Update release notes --- release_notes.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release_notes.md b/release_notes.md index 724b5828e..2fa164daa 100644 --- a/release_notes.md +++ b/release_notes.md @@ -2,7 +2,8 @@ - [#143](https://github.com/MehdiK/Humanizer/pull/143): Added Russian translation for future DateTime, TimeSpan and Now - [#144](https://github.com/MehdiK/Humanizer/pull/144): Danish localization (strings, tests) - [#149](https://github.com/MehdiK/Humanizer/pull/149): Number to words localisation improvements - + - [#155](https://github.com/MehdiK/Humanizer/pull/155): French and Belgian French localisation + [Commits](https://github.com/MehdiK/Humanizer/compare/v1.18.1...master) ###v1.18.1 - 2014-04-09 From 37dc3b44712469b6b455c6efab1ee14ac51832f7 Mon Sep 17 00:00:00 2001 From: Yanos Date: Thu, 10 Apr 2014 18:16:24 +0200 Subject: [PATCH 5/6] Add tests for french and belgian french --- src/Humanizer.Tests/Humanizer.Tests.csproj | 4 + .../Localisation/fr-BE/DateHumanizeTests.cs | 107 ++++++++++++++++ .../fr-BE/TimeSpanHumanizeTests.cs | 95 ++++++++++++++ .../Localisation/fr/DateHumanizeTests.cs | 119 ++++++++++++++++++ .../Localisation/fr/TimeSpanHumanizeTests.cs | 103 +++++++++++++++ 5 files changed, 428 insertions(+) create mode 100644 src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs create mode 100644 src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs create mode 100644 src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs create mode 100644 src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs diff --git a/src/Humanizer.Tests/Humanizer.Tests.csproj b/src/Humanizer.Tests/Humanizer.Tests.csproj index bdfac012a..505fbf34e 100644 --- a/src/Humanizer.Tests/Humanizer.Tests.csproj +++ b/src/Humanizer.Tests/Humanizer.Tests.csproj @@ -80,6 +80,10 @@ + + + + diff --git a/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs new file mode 100644 index 000000000..070cbd62d --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs @@ -0,0 +1,107 @@ +using Humanizer.Localisation; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.frBE +{ + public class DateHumanizeTests : AmbientCulture + { + public DateHumanizeTests() : base("fr-BE") { } + + [Theory] + [InlineData(1, "il y a une seconde")] + [InlineData(10, "il y a 10 secondes")] + [InlineData(60, "il y a une minute")] + public void SecondsAgo(int seconds, string expected) { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une seconde")] + [InlineData(10, "dans 10 secondes")] + [InlineData(60, "dans une minute")] + public void SecondsFromNow(int seconds, string expected) { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une minute")] + [InlineData(10, "il y a 10 minutes")] + [InlineData(45, "il y a une heure")] + [InlineData(120, "il y a 2 heures")] + public void MinutesAgo(int minutes, string expected) { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une minute")] + [InlineData(10, "dans 10 minutes")] + [InlineData(45, "dans une heure")] + [InlineData(120, "dans 2 heures")] + public void MinutesFromNow(int minutes, string expected) { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une heure")] + [InlineData(10, "il y a 10 heures")] + [InlineData(24, "hier")] + public void HoursAgo(int hours, string expected) { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une heure")] + [InlineData(10, "dans 10 heures")] + [InlineData(24, "demain")] + public void HoursFromNow(int hours, string expected) { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); + } + + [Theory] + [InlineData(1, "hier")] + [InlineData(10, "il y a 10 jours")] + [InlineData(32, "il y a un mois")] + public void DaysAgo(int days, string expected) { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); + } + + [Theory] + [InlineData(1, "demain")] + [InlineData(10, "dans 10 jours")] + [InlineData(32, "dans un mois")] + public void DaysFromNow(int days, string expected) { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un mois")] + [InlineData(10, "il y a 10 mois")] + [InlineData(12, "il y a un an")] + public void MonthsAgo(int months, string expected) { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un mois")] + [InlineData(10, "dans 10 mois")] + [InlineData(12, "dans un an")] + public void MonthsFromNow(int months, string expected) { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un an")] + [InlineData(2, "il y a 2 ans")] + public void YearsAgo(int years, string expected) { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un an")] + [InlineData(2, "dans 2 ans")] + public void YearsFromNow(int years, string expected) { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); + } + + } +} diff --git a/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs new file mode 100644 index 000000000..ba93f9f7d --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs @@ -0,0 +1,95 @@ +using System; +using Xunit; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.frBE +{ + public class TimeSpanHumanizeTests : AmbientCulture + { + public TimeSpanHumanizeTests() : base("fr-BE") { } + + [Theory] + [InlineData(14, "2 semaines")] + [InlineData(7, "1 semaine")] + public void Weeks(int days, string expected) { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(6, "6 jours")] + [InlineData(1, "1 jour")] + public void Days(int days, string expected) { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 heures")] + [InlineData(1, "1 heure")] + public void Hours(int hours, string expected) { + var actual = TimeSpan.FromHours(hours).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 minutes")] + [InlineData(1, "1 minute")] + public void Minutes(int minutes, string expected) { + var actual = TimeSpan.FromMinutes(minutes).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(135, "2 minutes")] + [InlineData(60, "1 minute")] + [InlineData(2, "2 secondes")] + [InlineData(1, "1 seconde")] + public void Seconds(int seconds, string expected) { + var actual = TimeSpan.FromSeconds(seconds).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2500, "2 secondes")] + [InlineData(1400, "1 seconde")] + [InlineData(2, "2 millisecondes")] + [InlineData(1, "1 milliseconde")] + public void Milliseconds(int ms, string expected) { + var actual = TimeSpan.FromMilliseconds(ms).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(0, 3, "pas de temps")] + [InlineData(10, 2, "10 millisecondes")] + [InlineData(1400, 2, "1 seconde, 400 millisecondes")] + [InlineData(2500, 2, "2 secondes, 500 millisecondes")] + [InlineData(120000, 2, "2 minutes")] + [InlineData(62000, 2, "1 minute, 2 secondes")] + [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] + [InlineData(3600020, 4, "1 heure, 20 millisecondes")] + [InlineData(3600020, 1, "1 heure")] + [InlineData(3603001, 2, "1 heure, 3 secondes")] + [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] + [InlineData(86400000, 3, "1 jour")] + [InlineData(86401000, 2, "1 jour, 1 seconde")] + [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] + [InlineData(1296000000, 1, "2 semaines")] + [InlineData(1299600000, 2, "2 semaines, 1 jour")] + [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] + [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] + [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] + public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) { + var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); + Assert.Equal(expected, actual); + } + + [Fact] + public void NoTime() { + var noTime = TimeSpan.Zero; + var actual = noTime.Humanize(); + Assert.Equal("pas de temps", actual); + } + } +} diff --git a/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs new file mode 100644 index 000000000..2c2b93a51 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs @@ -0,0 +1,119 @@ +using Humanizer.Localisation; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.fr +{ + public class DateHumanizeTests : AmbientCulture + { + public DateHumanizeTests() : base("fr") { } + + [Theory] + [InlineData(1, "il y a une seconde")] + [InlineData(10, "il y a 10 secondes")] + [InlineData(60, "il y a une minute")] + public void SecondsAgo(int seconds, string expected) + { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une seconde")] + [InlineData(10, "dans 10 secondes")] + [InlineData(60, "dans une minute")] + public void SecondsFromNow(int seconds, string expected) + { + DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une minute")] + [InlineData(10, "il y a 10 minutes")] + [InlineData(45, "il y a une heure")] + [InlineData(120, "il y a 2 heures")] + public void MinutesAgo(int minutes, string expected) + { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une minute")] + [InlineData(10, "dans 10 minutes")] + [InlineData(45, "dans une heure")] + [InlineData(120, "dans 2 heures")] + public void MinutesFromNow(int minutes, string expected) + { + DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a une heure")] + [InlineData(10, "il y a 10 heures")] + [InlineData(24, "hier")] + public void HoursAgo(int hours, string expected) + { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); + } + + [Theory] + [InlineData(1, "dans une heure")] + [InlineData(10, "dans 10 heures")] + [InlineData(24, "demain")] + public void HoursFromNow(int hours, string expected) + { + DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); + } + + [Theory] + [InlineData(1, "hier")] + [InlineData(10, "il y a 10 jours")] + [InlineData(32, "il y a un mois")] + public void DaysAgo(int days, string expected) + { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); + } + + [Theory] + [InlineData(1, "demain")] + [InlineData(10, "dans 10 jours")] + [InlineData(32, "dans un mois")] + public void DaysFromNow(int days, string expected) + { + DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un mois")] + [InlineData(10, "il y a 10 mois")] + [InlineData(12, "il y a un an")] + public void MonthsAgo(int months, string expected) + { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un mois")] + [InlineData(10, "dans 10 mois")] + [InlineData(12, "dans un an")] + public void MonthsFromNow(int months, string expected) + { + DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); + } + + [Theory] + [InlineData(1, "il y a un an")] + [InlineData(2, "il y a 2 ans")] + public void YearsAgo(int years, string expected) + { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); + } + + [Theory] + [InlineData(1, "dans un an")] + [InlineData(2, "dans 2 ans")] + public void YearsFromNow(int years, string expected) + { + DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); + } + + } +} diff --git a/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs new file mode 100644 index 000000000..fce174086 --- /dev/null +++ b/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs @@ -0,0 +1,103 @@ +using System; +using Xunit; +using Xunit.Extensions; + +namespace Humanizer.Tests.Localisation.fr +{ + public class TimeSpanHumanizeTests : AmbientCulture + { + public TimeSpanHumanizeTests() : base("fr") { } + + [Theory] + [InlineData(14, "2 semaines")] + [InlineData(7, "1 semaine")] + public void Weeks(int days, string expected) + { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(6, "6 jours")] + [InlineData(1, "1 jour")] + public void Days(int days, string expected) + { + var actual = TimeSpan.FromDays(days).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 heures")] + [InlineData(1, "1 heure")] + public void Hours(int hours, string expected) + { + var actual = TimeSpan.FromHours(hours).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2, "2 minutes")] + [InlineData(1, "1 minute")] + public void Minutes(int minutes, string expected) + { + var actual = TimeSpan.FromMinutes(minutes).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(135, "2 minutes")] + [InlineData(60, "1 minute")] + [InlineData(2, "2 secondes")] + [InlineData(1, "1 seconde")] + public void Seconds(int seconds, string expected) + { + var actual = TimeSpan.FromSeconds(seconds).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(2500, "2 secondes")] + [InlineData(1400, "1 seconde")] + [InlineData(2, "2 millisecondes")] + [InlineData(1, "1 milliseconde")] + public void Milliseconds(int ms, string expected) + { + var actual = TimeSpan.FromMilliseconds(ms).Humanize(); + Assert.Equal(expected, actual); + } + + [Theory] + [InlineData(0, 3, "pas de temps")] + [InlineData(10, 2, "10 millisecondes")] + [InlineData(1400, 2, "1 seconde, 400 millisecondes")] + [InlineData(2500, 2, "2 secondes, 500 millisecondes")] + [InlineData(120000, 2, "2 minutes")] + [InlineData(62000, 2, "1 minute, 2 secondes")] + [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] + [InlineData(3600020, 4, "1 heure, 20 millisecondes")] + [InlineData(3600020, 1, "1 heure")] + [InlineData(3603001, 2, "1 heure, 3 secondes")] + [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] + [InlineData(86400000, 3, "1 jour")] + [InlineData(86401000, 2, "1 jour, 1 seconde")] + [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] + [InlineData(1296000000, 1, "2 semaines")] + [InlineData(1299600000, 2, "2 semaines, 1 jour")] + [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] + [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] + [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] + public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) + { + var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); + Assert.Equal(expected, actual); + } + + [Fact] + public void NoTime() + { + var noTime = TimeSpan.Zero; + var actual = noTime.Humanize(); + Assert.Equal("pas de temps", actual); + } + } +} From 104a937a710edf5d908a056d7fc906ff8aacdf84 Mon Sep 17 00:00:00 2001 From: Yanos Date: Thu, 10 Apr 2014 19:52:23 +0200 Subject: [PATCH 6/6] Remove more redundants test cases --- .../Localisation/fr-BE/DateHumanizeTests.cs | 48 +++++++++--------- .../fr-BE/TimeSpanHumanizeTests.cs | 50 ++++++------------- .../Localisation/fr/DateHumanizeTests.cs | 12 ----- .../Localisation/fr/TimeSpanHumanizeTests.cs | 30 ----------- 4 files changed, 38 insertions(+), 102 deletions(-) diff --git a/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs index 070cbd62d..c18189cd8 100644 --- a/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs +++ b/src/Humanizer.Tests/Localisation/fr-BE/DateHumanizeTests.cs @@ -10,96 +10,96 @@ public DateHumanizeTests() : base("fr-BE") { } [Theory] [InlineData(1, "il y a une seconde")] [InlineData(10, "il y a 10 secondes")] - [InlineData(60, "il y a une minute")] - public void SecondsAgo(int seconds, string expected) { + public void SecondsAgo(int seconds, string expected) + { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); } [Theory] [InlineData(1, "dans une seconde")] [InlineData(10, "dans 10 secondes")] - [InlineData(60, "dans une minute")] - public void SecondsFromNow(int seconds, string expected) { + public void SecondsFromNow(int seconds, string expected) + { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); } [Theory] [InlineData(1, "il y a une minute")] [InlineData(10, "il y a 10 minutes")] - [InlineData(45, "il y a une heure")] - [InlineData(120, "il y a 2 heures")] - public void MinutesAgo(int minutes, string expected) { + public void MinutesAgo(int minutes, string expected) + { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); } [Theory] [InlineData(1, "dans une minute")] [InlineData(10, "dans 10 minutes")] - [InlineData(45, "dans une heure")] - [InlineData(120, "dans 2 heures")] - public void MinutesFromNow(int minutes, string expected) { + public void MinutesFromNow(int minutes, string expected) + { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); } [Theory] [InlineData(1, "il y a une heure")] [InlineData(10, "il y a 10 heures")] - [InlineData(24, "hier")] - public void HoursAgo(int hours, string expected) { + public void HoursAgo(int hours, string expected) + { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); } [Theory] [InlineData(1, "dans une heure")] [InlineData(10, "dans 10 heures")] - [InlineData(24, "demain")] - public void HoursFromNow(int hours, string expected) { + public void HoursFromNow(int hours, string expected) + { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); } [Theory] [InlineData(1, "hier")] [InlineData(10, "il y a 10 jours")] - [InlineData(32, "il y a un mois")] - public void DaysAgo(int days, string expected) { + public void DaysAgo(int days, string expected) + { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); } [Theory] [InlineData(1, "demain")] [InlineData(10, "dans 10 jours")] - [InlineData(32, "dans un mois")] - public void DaysFromNow(int days, string expected) { + public void DaysFromNow(int days, string expected) + { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); } [Theory] [InlineData(1, "il y a un mois")] [InlineData(10, "il y a 10 mois")] - [InlineData(12, "il y a un an")] - public void MonthsAgo(int months, string expected) { + public void MonthsAgo(int months, string expected) + { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); } [Theory] [InlineData(1, "dans un mois")] [InlineData(10, "dans 10 mois")] - [InlineData(12, "dans un an")] - public void MonthsFromNow(int months, string expected) { + public void MonthsFromNow(int months, string expected) + { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); } [Theory] [InlineData(1, "il y a un an")] [InlineData(2, "il y a 2 ans")] - public void YearsAgo(int years, string expected) { + public void YearsAgo(int years, string expected) + { DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); } [Theory] [InlineData(1, "dans un an")] [InlineData(2, "dans 2 ans")] - public void YearsFromNow(int years, string expected) { + public void YearsFromNow(int years, string expected) + { DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Future); } diff --git a/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs index ba93f9f7d..3ff9c0072 100644 --- a/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs +++ b/src/Humanizer.Tests/Localisation/fr-BE/TimeSpanHumanizeTests.cs @@ -11,7 +11,8 @@ public TimeSpanHumanizeTests() : base("fr-BE") { } [Theory] [InlineData(14, "2 semaines")] [InlineData(7, "1 semaine")] - public void Weeks(int days, string expected) { + public void Weeks(int days, string expected) + { var actual = TimeSpan.FromDays(days).Humanize(); Assert.Equal(expected, actual); } @@ -19,7 +20,8 @@ public void Weeks(int days, string expected) { [Theory] [InlineData(6, "6 jours")] [InlineData(1, "1 jour")] - public void Days(int days, string expected) { + public void Days(int days, string expected) + { var actual = TimeSpan.FromDays(days).Humanize(); Assert.Equal(expected, actual); } @@ -27,7 +29,8 @@ public void Days(int days, string expected) { [Theory] [InlineData(2, "2 heures")] [InlineData(1, "1 heure")] - public void Hours(int hours, string expected) { + public void Hours(int hours, string expected) + { var actual = TimeSpan.FromHours(hours).Humanize(); Assert.Equal(expected, actual); } @@ -35,58 +38,33 @@ public void Hours(int hours, string expected) { [Theory] [InlineData(2, "2 minutes")] [InlineData(1, "1 minute")] - public void Minutes(int minutes, string expected) { + public void Minutes(int minutes, string expected) + { var actual = TimeSpan.FromMinutes(minutes).Humanize(); Assert.Equal(expected, actual); } [Theory] - [InlineData(135, "2 minutes")] - [InlineData(60, "1 minute")] [InlineData(2, "2 secondes")] [InlineData(1, "1 seconde")] - public void Seconds(int seconds, string expected) { + public void Seconds(int seconds, string expected) + { var actual = TimeSpan.FromSeconds(seconds).Humanize(); Assert.Equal(expected, actual); } [Theory] - [InlineData(2500, "2 secondes")] - [InlineData(1400, "1 seconde")] [InlineData(2, "2 millisecondes")] [InlineData(1, "1 milliseconde")] - public void Milliseconds(int ms, string expected) { + public void Milliseconds(int ms, string expected) + { var actual = TimeSpan.FromMilliseconds(ms).Humanize(); Assert.Equal(expected, actual); } - [Theory] - [InlineData(0, 3, "pas de temps")] - [InlineData(10, 2, "10 millisecondes")] - [InlineData(1400, 2, "1 seconde, 400 millisecondes")] - [InlineData(2500, 2, "2 secondes, 500 millisecondes")] - [InlineData(120000, 2, "2 minutes")] - [InlineData(62000, 2, "1 minute, 2 secondes")] - [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] - [InlineData(3600020, 4, "1 heure, 20 millisecondes")] - [InlineData(3600020, 1, "1 heure")] - [InlineData(3603001, 2, "1 heure, 3 secondes")] - [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] - [InlineData(86400000, 3, "1 jour")] - [InlineData(86401000, 2, "1 jour, 1 seconde")] - [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] - [InlineData(1296000000, 1, "2 semaines")] - [InlineData(1299600000, 2, "2 semaines, 1 jour")] - [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] - [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] - [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] - public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) { - var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); - Assert.Equal(expected, actual); - } - [Fact] - public void NoTime() { + public void NoTime() + { var noTime = TimeSpan.Zero; var actual = noTime.Humanize(); Assert.Equal("pas de temps", actual); diff --git a/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs index 2c2b93a51..e8912c9f4 100644 --- a/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs +++ b/src/Humanizer.Tests/Localisation/fr/DateHumanizeTests.cs @@ -10,7 +10,6 @@ public DateHumanizeTests() : base("fr") { } [Theory] [InlineData(1, "il y a une seconde")] [InlineData(10, "il y a 10 secondes")] - [InlineData(60, "il y a une minute")] public void SecondsAgo(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); @@ -19,7 +18,6 @@ public void SecondsAgo(int seconds, string expected) [Theory] [InlineData(1, "dans une seconde")] [InlineData(10, "dans 10 secondes")] - [InlineData(60, "dans une minute")] public void SecondsFromNow(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); @@ -28,8 +26,6 @@ public void SecondsFromNow(int seconds, string expected) [Theory] [InlineData(1, "il y a une minute")] [InlineData(10, "il y a 10 minutes")] - [InlineData(45, "il y a une heure")] - [InlineData(120, "il y a 2 heures")] public void MinutesAgo(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); @@ -38,8 +34,6 @@ public void MinutesAgo(int minutes, string expected) [Theory] [InlineData(1, "dans une minute")] [InlineData(10, "dans 10 minutes")] - [InlineData(45, "dans une heure")] - [InlineData(120, "dans 2 heures")] public void MinutesFromNow(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); @@ -48,7 +42,6 @@ public void MinutesFromNow(int minutes, string expected) [Theory] [InlineData(1, "il y a une heure")] [InlineData(10, "il y a 10 heures")] - [InlineData(24, "hier")] public void HoursAgo(int hours, string expected) { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); @@ -57,7 +50,6 @@ public void HoursAgo(int hours, string expected) [Theory] [InlineData(1, "dans une heure")] [InlineData(10, "dans 10 heures")] - [InlineData(24, "demain")] public void HoursFromNow(int hours, string expected) { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); @@ -66,7 +58,6 @@ public void HoursFromNow(int hours, string expected) [Theory] [InlineData(1, "hier")] [InlineData(10, "il y a 10 jours")] - [InlineData(32, "il y a un mois")] public void DaysAgo(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); @@ -75,7 +66,6 @@ public void DaysAgo(int days, string expected) [Theory] [InlineData(1, "demain")] [InlineData(10, "dans 10 jours")] - [InlineData(32, "dans un mois")] public void DaysFromNow(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); @@ -84,7 +74,6 @@ public void DaysFromNow(int days, string expected) [Theory] [InlineData(1, "il y a un mois")] [InlineData(10, "il y a 10 mois")] - [InlineData(12, "il y a un an")] public void MonthsAgo(int months, string expected) { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); @@ -93,7 +82,6 @@ public void MonthsAgo(int months, string expected) [Theory] [InlineData(1, "dans un mois")] [InlineData(10, "dans 10 mois")] - [InlineData(12, "dans un an")] public void MonthsFromNow(int months, string expected) { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); diff --git a/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs index fce174086..36f75ac1b 100644 --- a/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs +++ b/src/Humanizer.Tests/Localisation/fr/TimeSpanHumanizeTests.cs @@ -45,8 +45,6 @@ public void Minutes(int minutes, string expected) } [Theory] - [InlineData(135, "2 minutes")] - [InlineData(60, "1 minute")] [InlineData(2, "2 secondes")] [InlineData(1, "1 seconde")] public void Seconds(int seconds, string expected) @@ -56,8 +54,6 @@ public void Seconds(int seconds, string expected) } [Theory] - [InlineData(2500, "2 secondes")] - [InlineData(1400, "1 seconde")] [InlineData(2, "2 millisecondes")] [InlineData(1, "1 milliseconde")] public void Milliseconds(int ms, string expected) @@ -66,32 +62,6 @@ public void Milliseconds(int ms, string expected) Assert.Equal(expected, actual); } - [Theory] - [InlineData(0, 3, "pas de temps")] - [InlineData(10, 2, "10 millisecondes")] - [InlineData(1400, 2, "1 seconde, 400 millisecondes")] - [InlineData(2500, 2, "2 secondes, 500 millisecondes")] - [InlineData(120000, 2, "2 minutes")] - [InlineData(62000, 2, "1 minute, 2 secondes")] - [InlineData(62020, 3, "1 minute, 2 secondes, 20 millisecondes")] - [InlineData(3600020, 4, "1 heure, 20 millisecondes")] - [InlineData(3600020, 1, "1 heure")] - [InlineData(3603001, 2, "1 heure, 3 secondes")] - [InlineData(3603001, 3, "1 heure, 3 secondes, 1 milliseconde")] - [InlineData(86400000, 3, "1 jour")] - [InlineData(86401000, 2, "1 jour, 1 seconde")] - [InlineData(86401200, 3, "1 jour, 1 seconde, 200 millisecondes")] - [InlineData(1296000000, 1, "2 semaines")] - [InlineData(1299600000, 2, "2 semaines, 1 jour")] - [InlineData(1299630020, 3, "2 semaines, 1 jour, 1 heure")] - [InlineData(1299630020, 4, "2 semaines, 1 jour, 1 heure, 30 secondes")] - [InlineData(1299630020, 5, "2 semaines, 1 jour, 1 heure, 30 secondes, 20 millisecondes")] - public void TimeSpanWithPrecesion(int milliseconds, int precesion, string expected) - { - var actual = TimeSpan.FromMilliseconds(milliseconds).Humanize(precesion); - Assert.Equal(expected, actual); - } - [Fact] public void NoTime() {