diff --git a/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs b/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs index a2515ad9a..050732006 100644 --- a/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/BitFieldEnumHumanizeTests.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xunit; +using Xunit; namespace Humanizer.Tests { diff --git a/src/Humanizer.Tests.Shared/BitFieldEnumUnderTest.cs b/src/Humanizer.Tests.Shared/BitFieldEnumUnderTest.cs index 69b78fdbc..65fe3571e 100644 --- a/src/Humanizer.Tests.Shared/BitFieldEnumUnderTest.cs +++ b/src/Humanizer.Tests.Shared/BitFieldEnumUnderTest.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Humanizer.Tests { diff --git a/src/Humanizer.Tests.Shared/Bytes/ComparingTests.cs b/src/Humanizer.Tests.Shared/Bytes/ComparingTests.cs index 0f4caea39..5ea23264e 100644 --- a/src/Humanizer.Tests.Shared/Bytes/ComparingTests.cs +++ b/src/Humanizer.Tests.Shared/Bytes/ComparingTests.cs @@ -34,8 +34,8 @@ public void CompareUntyped(double value, double valueToCompareWith, int expected } [Theory] - [InlineData(new[] { "1GB", "3KB", "5MB" }, new[] { "3KB", "5MB", "1GB"})] - [InlineData(new[] { "1MB", "3KB", "5MB" }, new[] { "3KB", "1MB", "5MB"})] + [InlineData(new[] { "1GB", "3KB", "5MB" }, new[] { "3KB", "5MB", "1GB" })] + [InlineData(new[] { "1MB", "3KB", "5MB" }, new[] { "3KB", "1MB", "5MB" })] public void SortList(IEnumerable values, IEnumerable expected) { var list = values.Select(ByteSize.Parse).ToList(); diff --git a/src/Humanizer.Tests.Shared/Bytes/CreatingTests.cs b/src/Humanizer.Tests.Shared/Bytes/CreatingTests.cs index e14e7f6eb..70360f215 100644 --- a/src/Humanizer.Tests.Shared/Bytes/CreatingTests.cs +++ b/src/Humanizer.Tests.Shared/Bytes/CreatingTests.cs @@ -31,7 +31,7 @@ public class CreatingTests public void Constructor() { var result = new ByteSize(1099511627776); - + Assert.Equal(8.796093022208e12, result.Bits); Assert.Equal(1099511627776, result.Bytes); Assert.Equal(1073741824, result.Kilobytes); diff --git a/src/Humanizer.Tests.Shared/CollectionHumanizeTests.cs b/src/Humanizer.Tests.Shared/CollectionHumanizeTests.cs index 9cc3dc676..6feb304f2 100644 --- a/src/Humanizer.Tests.Shared/CollectionHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/CollectionHumanizeTests.cs @@ -112,7 +112,7 @@ public void HumanizeHandlesNullItemsWithoutAnException() [Fact] public void HumanizeHandlesNullStringDisplayFormatterReturnsWithoutAnException() { - Assert.Null(Record.Exception(() => new[] { "A", "B", "C" }.Humanize(_ => (string)null))); + Assert.Null(Record.Exception(() => new[] { "A", "B", "C" }.Humanize(_ => null))); } [Fact] diff --git a/src/Humanizer.Tests.Shared/DateHumanize.cs b/src/Humanizer.Tests.Shared/DateHumanize.cs index 6009aabad..edfd67c1a 100644 --- a/src/Humanizer.Tests.Shared/DateHumanize.cs +++ b/src/Humanizer.Tests.Shared/DateHumanize.cs @@ -9,8 +9,9 @@ namespace Humanizer.Tests { public class DateHumanize { - readonly static object LockObject = new object(); - static void VerifyWithCurrentDate(string expectedString, TimeSpan deltaFromNow, CultureInfo culture) + private static readonly object LockObject = new object(); + + private static void VerifyWithCurrentDate(string expectedString, TimeSpan deltaFromNow, CultureInfo culture) { var utcNow = DateTime.UtcNow; var localNow = DateTime.Now; @@ -19,7 +20,7 @@ static void VerifyWithCurrentDate(string expectedString, TimeSpan deltaFromNow, VerifyWithDate(expectedString, deltaFromNow, culture, localNow, utcNow); } - static void VerifyWithDateInjection(string expectedString, TimeSpan deltaFromNow, CultureInfo culture) + private static void VerifyWithDateInjection(string expectedString, TimeSpan deltaFromNow, CultureInfo culture) { var utcNow = new DateTime(2013, 6, 20, 9, 58, 22, DateTimeKind.Utc); var now = new DateTime(2013, 6, 20, 11, 58, 22, DateTimeKind.Local); @@ -27,7 +28,7 @@ static void VerifyWithDateInjection(string expectedString, TimeSpan deltaFromNow VerifyWithDate(expectedString, deltaFromNow, culture, now, utcNow); } - static void VerifyWithDate(string expectedString, TimeSpan deltaFromBase, CultureInfo culture, DateTime baseDate, DateTime baseDateUtc) + private static void VerifyWithDate(string expectedString, TimeSpan deltaFromBase, CultureInfo culture, DateTime baseDate, DateTime baseDateUtc) { Assert.Equal(expectedString, baseDateUtc.Add(deltaFromBase).Humanize(utcDate: true, dateToCompareAgainst: baseDateUtc, culture: culture)); Assert.Equal(expectedString, baseDate.Add(deltaFromBase).Humanize(false, baseDate, culture: culture)); @@ -39,15 +40,21 @@ public static void Verify(string expectedString, int unit, TimeUnit timeUnit, Te lock (LockObject) { if (precision.HasValue) + { Configurator.DateTimeHumanizeStrategy = new PrecisionDateTimeHumanizeStrategy(precision.Value); + } else + { Configurator.DateTimeHumanizeStrategy = new DefaultDateTimeHumanizeStrategy(); + } var deltaFromNow = new TimeSpan(); unit = Math.Abs(unit); if (tense == Tense.Past) + { unit = -unit; + } switch (timeUnit) { @@ -67,10 +74,10 @@ public static void Verify(string expectedString, int unit, TimeUnit timeUnit, Te deltaFromNow = TimeSpan.FromDays(unit); break; case TimeUnit.Month: - deltaFromNow = TimeSpan.FromDays(unit*31); + deltaFromNow = TimeSpan.FromDays(unit * 31); break; case TimeUnit.Year: - deltaFromNow = TimeSpan.FromDays(unit*366); + deltaFromNow = TimeSpan.FromDays(unit * 366); break; } diff --git a/src/Humanizer.Tests.Shared/DateHumanizeDefaultStrategyTests.cs b/src/Humanizer.Tests.Shared/DateHumanizeDefaultStrategyTests.cs index 8c407f4b3..9e850640e 100644 --- a/src/Humanizer.Tests.Shared/DateHumanizeDefaultStrategyTests.cs +++ b/src/Humanizer.Tests.Shared/DateHumanizeDefaultStrategyTests.cs @@ -1,7 +1,7 @@ -using System.Globalization; +using System; +using System.Globalization; using Humanizer.Localisation; using Xunit; -using System; namespace Humanizer.Tests { diff --git a/src/Humanizer.Tests.Shared/DateTimeOffsetHumanizeTests.cs b/src/Humanizer.Tests.Shared/DateTimeOffsetHumanizeTests.cs index 8e9159e2e..93bbd3c21 100644 --- a/src/Humanizer.Tests.Shared/DateTimeOffsetHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/DateTimeOffsetHumanizeTests.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using Humanizer.Configuration; using Humanizer.DateTimeHumanizeStrategy; using Xunit; diff --git a/src/Humanizer.Tests.Shared/DehumanizeToEnumTests.cs b/src/Humanizer.Tests.Shared/DehumanizeToEnumTests.cs index 1a3bd0c15..7eee9803d 100644 --- a/src/Humanizer.Tests.Shared/DehumanizeToEnumTests.cs +++ b/src/Humanizer.Tests.Shared/DehumanizeToEnumTests.cs @@ -87,7 +87,7 @@ public void HonorsLocalizedDisplayAttribute() Assert.Equal(EnumUnderTest.MemberWithLocalizedDisplayAttribute, EnumTestsResources.MemberWithLocalizedDisplayAttribute.DehumanizeTo(typeof(EnumUnderTest))); } - struct DummyStructWithEnumInterfaces : IComparable, IFormattable + private struct DummyStructWithEnumInterfaces : IComparable, IFormattable { public int CompareTo(object obj) { @@ -185,13 +185,13 @@ public object ToType(Type conversionType, IFormatProvider provider) } } - enum DummyEnum + private enum DummyEnum { First, Second } } - + } diff --git a/src/Humanizer.Tests.Shared/EnumHumanizeTests.cs b/src/Humanizer.Tests.Shared/EnumHumanizeTests.cs index 1fa438cff..1b67b9703 100644 --- a/src/Humanizer.Tests.Shared/EnumHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/EnumHumanizeTests.cs @@ -5,7 +5,7 @@ namespace Humanizer.Tests public class EnumHumanizeTests { #if !NETFX_CORE - [Fact] + [Fact] public void HonorsDescriptionAttribute() { Assert.Equal(EnumTestsResources.MemberWithDescriptionAttribute, EnumUnderTest.MemberWithDescriptionAttribute.Humanize()); @@ -30,29 +30,29 @@ public void OnlyStringDescriptionsApply() Assert.Equal(EnumTestsResources.MemberWithImposterDescriptionAttribute, EnumUnderTest.MemberWithImposterDescriptionAttribute.Humanize()); } - [Fact] + [Fact] public void CanHumanizeMembersWithoutDescriptionAttribute() { Assert.Equal(EnumTestsResources.MemberWithoutDescriptionAttributeSentence, EnumUnderTest.MemberWithoutDescriptionAttribute.Humanize()); } - [Fact] + [Fact] public void CanApplyTitleCasingOnEnumHumanization() { Assert.Equal( - EnumTestsResources.MemberWithoutDescriptionAttributeTitle, + EnumTestsResources.MemberWithoutDescriptionAttributeTitle, EnumUnderTest.MemberWithoutDescriptionAttribute.Humanize(LetterCasing.Title)); } - [Fact] + [Fact] public void CanApplyLowerCaseCasingOnEnumHumanization() { Assert.Equal( - EnumTestsResources.MemberWithoutDescriptionAttributeLowerCase, + EnumTestsResources.MemberWithoutDescriptionAttributeLowerCase, EnumUnderTest.MemberWithoutDescriptionAttribute.Humanize(LetterCasing.LowerCase)); } - [Fact] + [Fact] public void AllCapitalMembersAreReturnedAsIs() { Assert.Equal(EnumUnderTest.ALLCAPITALS.ToString(), EnumUnderTest.ALLCAPITALS.Humanize()); @@ -74,6 +74,6 @@ public void HonorsLocalizedDisplayAttribute() { Assert.Equal(EnumTestsResources.MemberWithLocalizedDisplayAttribute, EnumUnderTest.MemberWithLocalizedDisplayAttribute.Humanize()); } - + } } diff --git a/src/Humanizer.Tests.Shared/EnumUnderTest.cs b/src/Humanizer.Tests.Shared/EnumUnderTest.cs index 041ddc0ac..905e91b65 100644 --- a/src/Humanizer.Tests.Shared/EnumUnderTest.cs +++ b/src/Humanizer.Tests.Shared/EnumUnderTest.cs @@ -66,7 +66,7 @@ public CustomDescriptionAttribute(string description) #if !NETFX_CORE public class DescriptionSubclassAttribute : DescriptionAttribute { - public DescriptionSubclassAttribute(string description):base(description) + public DescriptionSubclassAttribute(string description) : base(description) { } diff --git a/src/Humanizer.Tests.Shared/HeadingTests.cs b/src/Humanizer.Tests.Shared/HeadingTests.cs index 45b241eb3..e4b312ce2 100644 --- a/src/Humanizer.Tests.Shared/HeadingTests.cs +++ b/src/Humanizer.Tests.Shared/HeadingTests.cs @@ -5,49 +5,49 @@ namespace Humanizer.Tests [UseCulture("en-US")] public class HeadingTests { - [InlineData(0, "N")] - [InlineData(11.2, "N")] - [InlineData(11.3, "NNE")] - [InlineData(22.5, "NNE")] - [InlineData(33.7, "NNE")] - [InlineData(33.8, "NE")] - [InlineData(45, "NE")] - [InlineData(56.2, "NE")] - [InlineData(56.3, "ENE")] - [InlineData(67.5, "ENE")] - [InlineData(78.7, "ENE")] - [InlineData(78.8, "E")] - [InlineData(90, "E")] + [InlineData(0, "N")] + [InlineData(11.2, "N")] + [InlineData(11.3, "NNE")] + [InlineData(22.5, "NNE")] + [InlineData(33.7, "NNE")] + [InlineData(33.8, "NE")] + [InlineData(45, "NE")] + [InlineData(56.2, "NE")] + [InlineData(56.3, "ENE")] + [InlineData(67.5, "ENE")] + [InlineData(78.7, "ENE")] + [InlineData(78.8, "E")] + [InlineData(90, "E")] [InlineData(101.2, "E")] [InlineData(101.3, "ESE")] [InlineData(112.5, "ESE")] [InlineData(123.7, "ESE")] [InlineData(123.8, "SE")] - [InlineData(135, "SE")] + [InlineData(135, "SE")] [InlineData(146.2, "SE")] [InlineData(146.3, "SSE")] [InlineData(157.5, "SSE")] [InlineData(168.7, "SSE")] [InlineData(168.8, "S")] - [InlineData(180, "S")] + [InlineData(180, "S")] [InlineData(191.2, "S")] [InlineData(191.3, "SSW")] [InlineData(202.5, "SSW")] [InlineData(213.7, "SSW")] [InlineData(213.8, "SW")] - [InlineData(225, "SW")] + [InlineData(225, "SW")] [InlineData(236.2, "SW")] [InlineData(236.3, "WSW")] [InlineData(247.5, "WSW")] [InlineData(258.7, "WSW")] [InlineData(258.8, "W")] - [InlineData(270, "W")] + [InlineData(270, "W")] [InlineData(281.2, "W")] [InlineData(281.3, "WNW")] [InlineData(292.5, "WNW")] [InlineData(303.7, "WNW")] [InlineData(303.8, "NW")] - [InlineData(315, "NW")] + [InlineData(315, "NW")] [InlineData(326.2, "NW")] [InlineData(326.3, "NNW")] [InlineData(337.5, "NNW")] @@ -60,44 +60,44 @@ public void ToHeadingAbbreviated(double heading, string expected) Assert.Equal(expected, heading.ToHeading()); } - [InlineData(0, "north")] - [InlineData(22.5, "north-northeast")] - [InlineData(45, "northeast")] - [InlineData(67.5, "east-northeast")] - [InlineData(90, "east")] + [InlineData(0, "north")] + [InlineData(22.5, "north-northeast")] + [InlineData(45, "northeast")] + [InlineData(67.5, "east-northeast")] + [InlineData(90, "east")] [InlineData(112.5, "east-southeast")] - [InlineData(135, "southeast")] + [InlineData(135, "southeast")] [InlineData(157.5, "south-southeast")] - [InlineData(180, "south")] + [InlineData(180, "south")] [InlineData(202.5, "south-southwest")] - [InlineData(225, "southwest")] + [InlineData(225, "southwest")] [InlineData(247.5, "west-southwest")] - [InlineData(270, "west")] + [InlineData(270, "west")] [InlineData(292.5, "west-northwest")] - [InlineData(315, "northwest")] + [InlineData(315, "northwest")] [InlineData(337.5, "north-northwest")] - [InlineData(720, "north")] + [InlineData(720, "north")] [Theory] public void ToHeading(double heading, string expected) { Assert.Equal(expected, heading.ToHeading(HeadingStyle.Full)); } - [InlineData("N" , 0)] + [InlineData("N", 0)] [InlineData("NNE", 22.5)] - [InlineData("NE" , 45)] + [InlineData("NE", 45)] [InlineData("ENE", 67.5)] - [InlineData("E" , 90)] + [InlineData("E", 90)] [InlineData("ESE", 112.5)] - [InlineData("SE" , 135)] + [InlineData("SE", 135)] [InlineData("SSE", 157.5)] - [InlineData("S" , 180)] + [InlineData("S", 180)] [InlineData("SSW", 202.5)] - [InlineData("SW" , 225)] + [InlineData("SW", 225)] [InlineData("WSW", 247.5)] - [InlineData("W" , 270)] + [InlineData("W", 270)] [InlineData("WNW", 292.5)] - [InlineData("NW" , 315)] + [InlineData("NW", 315)] [InlineData("NNW", 337.5)] [Theory] public void FromShortHeading(string heading, double expected) @@ -105,49 +105,49 @@ public void FromShortHeading(string heading, double expected) Assert.Equal(expected, heading.FromAbbreviatedHeading()); } - [InlineData(0, '↑')] - [InlineData(11.2, '↑')] - [InlineData(11.3, '↑')] - [InlineData(22.5, '↗')] - [InlineData(33.7, '↗')] - [InlineData(33.8, '↗')] - [InlineData(45, '↗')] - [InlineData(56.2, '↗')] - [InlineData(56.3, '↗')] - [InlineData(67.5, '→')] - [InlineData(78.7, '→')] - [InlineData(78.8, '→')] - [InlineData(90, '→')] + [InlineData(0, '↑')] + [InlineData(11.2, '↑')] + [InlineData(11.3, '↑')] + [InlineData(22.5, '↗')] + [InlineData(33.7, '↗')] + [InlineData(33.8, '↗')] + [InlineData(45, '↗')] + [InlineData(56.2, '↗')] + [InlineData(56.3, '↗')] + [InlineData(67.5, '→')] + [InlineData(78.7, '→')] + [InlineData(78.8, '→')] + [InlineData(90, '→')] [InlineData(101.2, '→')] [InlineData(101.3, '→')] [InlineData(112.5, '↘')] [InlineData(123.7, '↘')] [InlineData(123.8, '↘')] - [InlineData(135, '↘')] + [InlineData(135, '↘')] [InlineData(146.2, '↘')] [InlineData(146.3, '↘')] [InlineData(157.5, '↓')] [InlineData(168.7, '↓')] [InlineData(168.8, '↓')] - [InlineData(180, '↓')] + [InlineData(180, '↓')] [InlineData(191.2, '↓')] [InlineData(191.3, '↓')] [InlineData(202.5, '↙')] [InlineData(213.7, '↙')] [InlineData(213.8, '↙')] - [InlineData(225, '↙')] + [InlineData(225, '↙')] [InlineData(236.2, '↙')] [InlineData(236.3, '↙')] [InlineData(247.5, '←')] [InlineData(258.7, '←')] [InlineData(258.8, '←')] - [InlineData(270, '←')] + [InlineData(270, '←')] [InlineData(281.2, '←')] [InlineData(281.3, '←')] [InlineData(292.5, '↖')] [InlineData(303.7, '↖')] [InlineData(303.8, '↖')] - [InlineData(315, '↖')] + [InlineData(315, '↖')] [InlineData(326.2, '↖')] [InlineData(326.3, '↖')] [InlineData(337.5, '↑')] diff --git a/src/Humanizer.Tests.Shared/InflectorTests.cs b/src/Humanizer.Tests.Shared/InflectorTests.cs index 0f824c13c..b319456e1 100644 --- a/src/Humanizer.Tests.Shared/InflectorTests.cs +++ b/src/Humanizer.Tests.Shared/InflectorTests.cs @@ -27,7 +27,7 @@ namespace Humanizer.Tests { - public class InflectorTests + public class InflectorTests { public readonly IList PluralTestData = new List(); @@ -150,201 +150,201 @@ public void Kebaberize(string input, string expectedOutput) } } - class PluralTestSource : IEnumerable + internal class PluralTestSource : IEnumerable { public IEnumerator GetEnumerator() { - yield return new object[] {"search", "searches"}; - yield return new object[] {"switch", "switches"}; - yield return new object[] {"fix", "fixes"}; - yield return new object[] {"box", "boxes"}; - yield return new object[] {"process", "processes"}; - yield return new object[] {"address", "addresses"}; - yield return new object[] {"case", "cases"}; - yield return new object[] {"stack", "stacks"}; - yield return new object[] {"wish", "wishes"}; - yield return new object[] {"fish", "fish"}; - - yield return new object[] {"category", "categories"}; - yield return new object[] {"query", "queries"}; - yield return new object[] {"ability", "abilities"}; - yield return new object[] {"agency", "agencies"}; - yield return new object[] {"movie", "movies"}; - - yield return new object[] {"archive", "archives"}; - - yield return new object[] {"index", "indices"}; - - yield return new object[] {"wife", "wives"}; - yield return new object[] {"safe", "saves"}; - yield return new object[] {"half", "halves"}; - - yield return new object[] {"move", "moves"}; - - yield return new object[] {"salesperson", "salespeople"}; - yield return new object[] {"person", "people"}; - - yield return new object[] {"spokesman", "spokesmen"}; - yield return new object[] {"man", "men"}; - yield return new object[] {"woman", "women"}; + yield return new object[] { "search", "searches" }; + yield return new object[] { "switch", "switches" }; + yield return new object[] { "fix", "fixes" }; + yield return new object[] { "box", "boxes" }; + yield return new object[] { "process", "processes" }; + yield return new object[] { "address", "addresses" }; + yield return new object[] { "case", "cases" }; + yield return new object[] { "stack", "stacks" }; + yield return new object[] { "wish", "wishes" }; + yield return new object[] { "fish", "fish" }; + + yield return new object[] { "category", "categories" }; + yield return new object[] { "query", "queries" }; + yield return new object[] { "ability", "abilities" }; + yield return new object[] { "agency", "agencies" }; + yield return new object[] { "movie", "movies" }; + + yield return new object[] { "archive", "archives" }; + + yield return new object[] { "index", "indices" }; + + yield return new object[] { "wife", "wives" }; + yield return new object[] { "safe", "saves" }; + yield return new object[] { "half", "halves" }; + + yield return new object[] { "move", "moves" }; + + yield return new object[] { "salesperson", "salespeople" }; + yield return new object[] { "person", "people" }; + + yield return new object[] { "spokesman", "spokesmen" }; + yield return new object[] { "man", "men" }; + yield return new object[] { "woman", "women" }; yield return new object[] { "freshman", "freshmen" }; yield return new object[] { "chairman", "chairmen" }; yield return new object[] { "human", "humans" }; yield return new object[] { "personnel", "personnel" }; - yield return new object[] {"basis", "bases"}; - yield return new object[] {"diagnosis", "diagnoses"}; + yield return new object[] { "basis", "bases" }; + yield return new object[] { "diagnosis", "diagnoses" }; - yield return new object[] {"datum", "data"}; - yield return new object[] {"medium", "media"}; - yield return new object[] {"analysis", "analyses"}; + yield return new object[] { "datum", "data" }; + yield return new object[] { "medium", "media" }; + yield return new object[] { "analysis", "analyses" }; - yield return new object[] {"node_child", "node_children"}; - yield return new object[] {"child", "children"}; + yield return new object[] { "node_child", "node_children" }; + yield return new object[] { "child", "children" }; - yield return new object[] {"experience", "experiences"}; - yield return new object[] {"day", "days"}; + yield return new object[] { "experience", "experiences" }; + yield return new object[] { "day", "days" }; - yield return new object[] {"comment", "comments"}; - yield return new object[] {"foobar", "foobars"}; - yield return new object[] {"newsletter", "newsletters"}; + yield return new object[] { "comment", "comments" }; + yield return new object[] { "foobar", "foobars" }; + yield return new object[] { "newsletter", "newsletters" }; - yield return new object[] {"old_news", "old_news"}; - yield return new object[] {"news", "news"}; + yield return new object[] { "old_news", "old_news" }; + yield return new object[] { "news", "news" }; - yield return new object[] {"series", "series"}; - yield return new object[] {"species", "species"}; + yield return new object[] { "series", "series" }; + yield return new object[] { "species", "species" }; - yield return new object[] {"quiz", "quizzes"}; + yield return new object[] { "quiz", "quizzes" }; - yield return new object[] {"perspective", "perspectives"}; + yield return new object[] { "perspective", "perspectives" }; - yield return new object[] {"ox", "oxen"}; - yield return new object[] {"photo", "photos"}; - yield return new object[] {"buffalo", "buffaloes"}; - yield return new object[] {"tomato", "tomatoes"}; - yield return new object[] {"dwarf", "dwarves"}; - yield return new object[] {"elf", "elves"}; - yield return new object[] {"information", "information"}; - yield return new object[] {"equipment", "equipment"}; - yield return new object[] {"bus", "buses"}; - yield return new object[] {"status", "statuses"}; - yield return new object[] {"status_code", "status_codes"}; - yield return new object[] {"mouse", "mice"}; + yield return new object[] { "ox", "oxen" }; + yield return new object[] { "photo", "photos" }; + yield return new object[] { "buffalo", "buffaloes" }; + yield return new object[] { "tomato", "tomatoes" }; + yield return new object[] { "dwarf", "dwarves" }; + yield return new object[] { "elf", "elves" }; + yield return new object[] { "information", "information" }; + yield return new object[] { "equipment", "equipment" }; + yield return new object[] { "bus", "buses" }; + yield return new object[] { "status", "statuses" }; + yield return new object[] { "status_code", "status_codes" }; + yield return new object[] { "mouse", "mice" }; - yield return new object[] {"louse", "lice"}; - yield return new object[] {"house", "houses"}; - yield return new object[] {"octopus", "octopi"}; - yield return new object[] {"alias", "aliases"}; - yield return new object[] {"portfolio", "portfolios"}; - yield return new object[] {"criterion", "criteria"}; + yield return new object[] { "louse", "lice" }; + yield return new object[] { "house", "houses" }; + yield return new object[] { "octopus", "octopi" }; + yield return new object[] { "alias", "aliases" }; + yield return new object[] { "portfolio", "portfolios" }; + yield return new object[] { "criterion", "criteria" }; - yield return new object[] {"vertex", "vertices"}; - yield return new object[] {"matrix", "matrices"}; + yield return new object[] { "vertex", "vertices" }; + yield return new object[] { "matrix", "matrices" }; - yield return new object[] {"axis", "axes"}; - yield return new object[] {"testis", "testes"}; - yield return new object[] {"crisis", "crises"}; + yield return new object[] { "axis", "axes" }; + yield return new object[] { "testis", "testes" }; + yield return new object[] { "crisis", "crises" }; - yield return new object[] {"rice", "rice"}; - yield return new object[] {"shoe", "shoes"}; + yield return new object[] { "rice", "rice" }; + yield return new object[] { "shoe", "shoes" }; - yield return new object[] {"horse", "horses"}; - yield return new object[] {"prize", "prizes"}; - yield return new object[] {"edge", "edges"}; + yield return new object[] { "horse", "horses" }; + yield return new object[] { "prize", "prizes" }; + yield return new object[] { "edge", "edges" }; /* Tests added by Bas Jansen */ - yield return new object[] {"goose", "geese"}; - yield return new object[] {"deer", "deer"}; - yield return new object[] {"sheep", "sheep"}; - yield return new object[] {"wolf", "wolves"}; - yield return new object[] {"volcano", "volcanoes"}; - yield return new object[] {"aircraft", "aircraft"}; - yield return new object[] {"alumna", "alumnae"}; - yield return new object[] {"alumnus", "alumni"}; - yield return new object[] {"fungus", "fungi"}; - yield return new object[] {"water", "water"}; - yield return new object[] {"waters", "waters"}; - yield return new object[] {"semen", "semen"}; - yield return new object[] {"sperm", "sperm"}; - - yield return new object[] {"wave","waves"}; - - yield return new object[] {"campus", "campuses"}; - - yield return new object[] {"is", "are"}; - - yield return new object[] {"addendum","addenda"}; - yield return new object[] {"alga","algae"}; - yield return new object[] {"apparatus","apparatuses"}; - yield return new object[] {"appendix","appendices"}; - yield return new object[] {"bias","biases"}; - yield return new object[] {"bison","bison"}; - yield return new object[] {"blitz","blitzes"}; - yield return new object[] {"buzz","buzzes"}; - yield return new object[] {"cactus","cacti"}; - yield return new object[] {"corps","corps"}; - yield return new object[] {"curriculum","curricula"}; - yield return new object[] {"database","databases"}; - yield return new object[] {"die","dice"}; - yield return new object[] {"echo","echoes"}; - yield return new object[] {"ellipsis","ellipses"}; - yield return new object[] {"elk","elk"}; - yield return new object[] {"emphasis","emphases"}; - yield return new object[] {"embargo","embargoes"}; - yield return new object[] {"focus","foci"}; - yield return new object[] {"foot","feet"}; - yield return new object[] {"fuse", "fuses" }; - yield return new object[] {"grass","grass"}; - yield return new object[] {"hair","hair"}; - yield return new object[] {"hero","heroes"}; - yield return new object[] {"hippopotamus","hippopotami"}; - yield return new object[] {"hoof","hooves"}; - yield return new object[] {"iris","irises"}; - yield return new object[] {"larva","larvae"}; - yield return new object[] {"leaf","leaves"}; - yield return new object[] {"loaf","loaves"}; - yield return new object[] {"luggage","luggage"}; - yield return new object[] {"means","means"}; - yield return new object[] {"millennium","millennia"}; - yield return new object[] {"moose","moose"}; - yield return new object[] {"mosquito","mosquitoes"}; - yield return new object[] {"mud","mud"}; - yield return new object[] {"nucleus","nuclei"}; - yield return new object[] {"neurosis","neuroses"}; - yield return new object[] {"oasis","oases"}; - yield return new object[] {"offspring","offspring"}; - yield return new object[] {"paralysis","paralyses"}; - yield return new object[] {"phenomenon","phenomena"}; - yield return new object[] {"potato","potatoes"}; - yield return new object[] {"radius","radii"}; - yield return new object[] {"salmon","salmon"}; - yield return new object[] {"scissors","scissors"}; - yield return new object[] {"shrimp","shrimp"}; - yield return new object[] {"someone","someone"}; - yield return new object[] {"stimulus","stimuli"}; - yield return new object[] {"swine","swine"}; - yield return new object[] {"syllabus","syllabi"}; - yield return new object[] {"that","those"}; - yield return new object[] {"thief","thieves"}; - yield return new object[] {"this","these"}; - yield return new object[] {"tooth","teeth"}; - yield return new object[] {"torpedo","torpedoes"}; - yield return new object[] {"trellis","trellises"}; - yield return new object[] {"trout","trout"}; - yield return new object[] {"tuna","tuna"}; - yield return new object[] {"vertebra","vertebrae"}; - yield return new object[] {"veto","vetoes"}; - yield return new object[] {"virus","viruses"}; - yield return new object[] {"walrus","walruses"}; - yield return new object[] {"waltz","waltzes"}; - yield return new object[] {"zombie","zombies"}; - - yield return new object[] {"cookie","cookies"}; - yield return new object[] {"bookie","bookies"}; - yield return new object[] {"rookie","rookies"}; - yield return new object[] {"roomie","roomies"}; - yield return new object[] {"smoothie","smoothies"}; + yield return new object[] { "goose", "geese" }; + yield return new object[] { "deer", "deer" }; + yield return new object[] { "sheep", "sheep" }; + yield return new object[] { "wolf", "wolves" }; + yield return new object[] { "volcano", "volcanoes" }; + yield return new object[] { "aircraft", "aircraft" }; + yield return new object[] { "alumna", "alumnae" }; + yield return new object[] { "alumnus", "alumni" }; + yield return new object[] { "fungus", "fungi" }; + yield return new object[] { "water", "water" }; + yield return new object[] { "waters", "waters" }; + yield return new object[] { "semen", "semen" }; + yield return new object[] { "sperm", "sperm" }; + + yield return new object[] { "wave", "waves" }; + + yield return new object[] { "campus", "campuses" }; + + yield return new object[] { "is", "are" }; + + yield return new object[] { "addendum", "addenda" }; + yield return new object[] { "alga", "algae" }; + yield return new object[] { "apparatus", "apparatuses" }; + yield return new object[] { "appendix", "appendices" }; + yield return new object[] { "bias", "biases" }; + yield return new object[] { "bison", "bison" }; + yield return new object[] { "blitz", "blitzes" }; + yield return new object[] { "buzz", "buzzes" }; + yield return new object[] { "cactus", "cacti" }; + yield return new object[] { "corps", "corps" }; + yield return new object[] { "curriculum", "curricula" }; + yield return new object[] { "database", "databases" }; + yield return new object[] { "die", "dice" }; + yield return new object[] { "echo", "echoes" }; + yield return new object[] { "ellipsis", "ellipses" }; + yield return new object[] { "elk", "elk" }; + yield return new object[] { "emphasis", "emphases" }; + yield return new object[] { "embargo", "embargoes" }; + yield return new object[] { "focus", "foci" }; + yield return new object[] { "foot", "feet" }; + yield return new object[] { "fuse", "fuses" }; + yield return new object[] { "grass", "grass" }; + yield return new object[] { "hair", "hair" }; + yield return new object[] { "hero", "heroes" }; + yield return new object[] { "hippopotamus", "hippopotami" }; + yield return new object[] { "hoof", "hooves" }; + yield return new object[] { "iris", "irises" }; + yield return new object[] { "larva", "larvae" }; + yield return new object[] { "leaf", "leaves" }; + yield return new object[] { "loaf", "loaves" }; + yield return new object[] { "luggage", "luggage" }; + yield return new object[] { "means", "means" }; + yield return new object[] { "millennium", "millennia" }; + yield return new object[] { "moose", "moose" }; + yield return new object[] { "mosquito", "mosquitoes" }; + yield return new object[] { "mud", "mud" }; + yield return new object[] { "nucleus", "nuclei" }; + yield return new object[] { "neurosis", "neuroses" }; + yield return new object[] { "oasis", "oases" }; + yield return new object[] { "offspring", "offspring" }; + yield return new object[] { "paralysis", "paralyses" }; + yield return new object[] { "phenomenon", "phenomena" }; + yield return new object[] { "potato", "potatoes" }; + yield return new object[] { "radius", "radii" }; + yield return new object[] { "salmon", "salmon" }; + yield return new object[] { "scissors", "scissors" }; + yield return new object[] { "shrimp", "shrimp" }; + yield return new object[] { "someone", "someone" }; + yield return new object[] { "stimulus", "stimuli" }; + yield return new object[] { "swine", "swine" }; + yield return new object[] { "syllabus", "syllabi" }; + yield return new object[] { "that", "those" }; + yield return new object[] { "thief", "thieves" }; + yield return new object[] { "this", "these" }; + yield return new object[] { "tooth", "teeth" }; + yield return new object[] { "torpedo", "torpedoes" }; + yield return new object[] { "trellis", "trellises" }; + yield return new object[] { "trout", "trout" }; + yield return new object[] { "tuna", "tuna" }; + yield return new object[] { "vertebra", "vertebrae" }; + yield return new object[] { "veto", "vetoes" }; + yield return new object[] { "virus", "viruses" }; + yield return new object[] { "walrus", "walruses" }; + yield return new object[] { "waltz", "waltzes" }; + yield return new object[] { "zombie", "zombies" }; + + yield return new object[] { "cookie", "cookies" }; + yield return new object[] { "bookie", "bookies" }; + yield return new object[] { "rookie", "rookies" }; + yield return new object[] { "roomie", "roomies" }; + yield return new object[] { "smoothie", "smoothies" }; } IEnumerator IEnumerable.GetEnumerator() diff --git a/src/Humanizer.Tests.Shared/Localisation/DefaultFormatterTests.cs b/src/Humanizer.Tests.Shared/Localisation/DefaultFormatterTests.cs index daa38f51c..a2df2fe48 100644 --- a/src/Humanizer.Tests.Shared/Localisation/DefaultFormatterTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/DefaultFormatterTests.cs @@ -1,7 +1,4 @@ using System; -using System.Globalization; -using Humanizer.Localisation; -using Humanizer.Localisation.Formatters; using Xunit; namespace Humanizer.Tests.Localisation @@ -13,7 +10,7 @@ public class DefaultFormatterTests [UseCulture("es")] public void HandlesNotImplementedCollectionFormattersGracefully() { - var a = new[] {DateTime.UtcNow, DateTime.UtcNow.AddDays(10)}; + var a = new[] { DateTime.UtcNow, DateTime.UtcNow.AddDays(10) }; var b = a.Humanize(); Assert.Equal(a[0] + " & " + a[1], b); diff --git a/src/Humanizer.Tests.Shared/Localisation/af/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/af/DateHumanizeTests.cs index 258f031ed..170dd1df3 100644 --- a/src/Humanizer.Tests.Shared/Localisation/af/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/af/DateHumanizeTests.cs @@ -1,5 +1,4 @@ -using System; -using Humanizer.Localisation; +using Humanizer.Localisation; using Xunit; namespace Humanizer.Tests.Localisation.af diff --git a/src/Humanizer.Tests.Shared/Localisation/af/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/af/NumberToWordsTests.cs index 21dea23c6..e274a9cff 100644 --- a/src/Humanizer.Tests.Shared/Localisation/af/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/af/NumberToWordsTests.cs @@ -87,7 +87,7 @@ public void ToWords(int number, string expected) [InlineData(1000000, "miljoenste")] public void ToOrdinalWords(int number, string words) { - Assert.Equal(words, number.ToOrdinalWords()); + Assert.Equal(words, number.ToOrdinalWords()); } [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/ar/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/ar/NumberToWordsTests.cs index 6914a793a..4bc41283a 100644 --- a/src/Humanizer.Tests.Shared/Localisation/ar/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/ar/NumberToWordsTests.cs @@ -1,5 +1,4 @@ -using Humanizer.Localisation.NumberToWords; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.ar { diff --git a/src/Humanizer.Tests.Shared/Localisation/bn-BD/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/bn-BD/NumberToWordsTests.cs index 09c8f9505..d74fa2111 100644 --- a/src/Humanizer.Tests.Shared/Localisation/bn-BD/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/bn-BD/NumberToWordsTests.cs @@ -63,7 +63,7 @@ public void ToWords(int number, string expected) [InlineData(18, "অষ্টাদশ")] [InlineData(19, "উনিশ তম")] [InlineData(20, "বিশ তম")] - [InlineData(21, "একুশ তম")] + [InlineData(21, "একুশ তম")] [InlineData(100, "শত তম")] [InlineData(112, "একশ বারো তম")] [InlineData(118, "একশ আঠারো তম")] diff --git a/src/Humanizer.Tests.Shared/Localisation/cs/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/cs/DateHumanizeTests.cs index 032078aa0..bb91a8908 100644 --- a/src/Humanizer.Tests.Shared/Localisation/cs/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/cs/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.cs { [UseCulture("cs-CZ")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(1, "za sekundu")] diff --git a/src/Humanizer.Tests.Shared/Localisation/de/CollectionFormatterTests.cs b/src/Humanizer.Tests.Shared/Localisation/de/CollectionFormatterTests.cs index 6645799cc..cdef0ac7c 100644 --- a/src/Humanizer.Tests.Shared/Localisation/de/CollectionFormatterTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/de/CollectionFormatterTests.cs @@ -4,13 +4,13 @@ namespace Humanizer.Tests.Localisation.de { [UseCulture("de")] - public class CollectionFormatterTests + public class CollectionFormatterTests { [Fact] public void OneItem() { - var collection = new List(new int[] {1}); + var collection = new List(new int[] { 1 }); var humanized = "1"; Assert.Equal(humanized, collection.Humanize()); } @@ -18,7 +18,7 @@ public void OneItem() [Fact] public void TwoItems() { - var collection = new List(new int[] {1, 2}); + var collection = new List(new int[] { 1, 2 }); var humanized = "1 und 2"; Assert.Equal(humanized, collection.Humanize()); } @@ -26,7 +26,7 @@ public void TwoItems() [Fact] public void MoreThanTwoItems() { - var collection = new List(new int[] {1, 2, 3}); + var collection = new List(new int[] { 1, 2, 3 }); var humanized = "1, 2 und 3"; Assert.Equal(humanized, collection.Humanize()); } diff --git a/src/Humanizer.Tests.Shared/Localisation/de/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/de/DateHumanizeTests.cs index 7d08b4d35..87184681b 100644 --- a/src/Humanizer.Tests.Shared/Localisation/de/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/de/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.de { [UseCulture("de-DE")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/el/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/el/DateHumanizeTests.cs index e49b5a906..b8b2a7b44 100644 --- a/src/Humanizer.Tests.Shared/Localisation/el/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/el/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.el { [UseCulture("el")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/es/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/es/DateHumanizeTests.cs index 42a28116a..013d98a27 100644 --- a/src/Humanizer.Tests.Shared/Localisation/es/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/es/DateHumanizeTests.cs @@ -1,17 +1,16 @@ -using System; -using Humanizer.Localisation; +using Humanizer.Localisation; using Xunit; namespace Humanizer.Tests.Localisation.es { [UseCulture("es-ES")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(1, "hace un segundo")] [InlineData(2, "hace 2 segundos")] - public void SecondsAgo(int seconds, string expected) + public void SecondsAgo(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); } @@ -19,7 +18,7 @@ public void SecondsAgo(int seconds, string expected) [Theory] [InlineData(1, "en un segundo")] [InlineData(2, "en 2 segundos")] - public void SecondsFromNow(int seconds, string expected) + public void SecondsFromNow(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); } @@ -28,7 +27,7 @@ public void SecondsFromNow(int seconds, string expected) [InlineData(1, "hace un minuto")] [InlineData(2, "hace 2 minutos")] [InlineData(60, "hace una hora")] - public void MinutesAgo(int minutes, string expected) + public void MinutesAgo(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); } @@ -36,7 +35,7 @@ public void MinutesAgo(int minutes, string expected) [Theory] [InlineData(1, "en un minuto")] [InlineData(2, "en 2 minutos")] - public void MinutesFromNow(int minutes, string expected) + public void MinutesFromNow(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); } @@ -44,7 +43,7 @@ public void MinutesFromNow(int minutes, string expected) [Theory] [InlineData(1, "hace una hora")] [InlineData(2, "hace 2 horas")] - public void HoursAgo(int hours, string expected) + public void HoursAgo(int hours, string expected) { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); } @@ -52,7 +51,7 @@ public void HoursAgo(int hours, string expected) [Theory] [InlineData(1, "en una hora")] [InlineData(2, "en 2 horas")] - public void HoursFromNow(int hours, string expected) + public void HoursFromNow(int hours, string expected) { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); } @@ -60,7 +59,7 @@ public void HoursFromNow(int hours, string expected) [Theory] [InlineData(1, "ayer")] [InlineData(2, "hace 2 días")] - public void DaysAgo(int days, string expected) + public void DaysAgo(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); } @@ -68,7 +67,7 @@ public void DaysAgo(int days, string expected) [Theory] [InlineData(1, "mañana")] [InlineData(2, "en 2 días")] - public void DaysFromNow(int days, string expected) + public void DaysFromNow(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); } @@ -76,7 +75,7 @@ public void DaysFromNow(int days, string expected) [Theory] [InlineData(1, "hace un mes")] [InlineData(2, "hace 2 meses")] - public void MonthsAgo(int months, string expected) + public void MonthsAgo(int months, string expected) { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); } @@ -84,7 +83,7 @@ public void MonthsAgo(int months, string expected) [Theory] [InlineData(1, "en un mes")] [InlineData(2, "en 2 meses")] - public void MonthsFromNow(int months, string expected) + public void MonthsFromNow(int months, string expected) { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); } @@ -92,7 +91,7 @@ public void MonthsFromNow(int months, string expected) [Theory] [InlineData(1, "hace un año")] [InlineData(2, "hace 2 años")] - public void YearsAgo(int years, string expected) + public void YearsAgo(int years, string expected) { DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); } @@ -100,7 +99,7 @@ public void YearsAgo(int years, string expected) [Theory] [InlineData(1, "en un año")] [InlineData(2, "en 2 años")] - 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.Shared/Localisation/es/NumberToWordsFeminineTest.cs b/src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsFeminineTest.cs index 838baf81f..8e972d69c 100644 --- a/src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsFeminineTest.cs +++ b/src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsFeminineTest.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.es { [UseCulture("es-ES")] - public class NumberToWordsFeminineTests + public class NumberToWordsFeminineTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsTests.cs index 87f48b4ca..35585a048 100644 --- a/src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/es/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.es { [UseCulture("es-ES")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] @@ -52,13 +52,13 @@ public void ToWords(int number, string expected) // TODO: This data is suspect since null cannot go into GramaticalGender [Theory] - // [InlineData(1, "primer", null)] + // [InlineData(1, "primer", null)] [InlineData(1, "primero", GrammaticalGender.Masculine)] [InlineData(1, "primera", GrammaticalGender.Feminine)] [InlineData(2, "segundo", GrammaticalGender.Masculine)] [InlineData(2, "segunda", GrammaticalGender.Feminine)] [InlineData(2, "segundo", GrammaticalGender.Neuter)] - // [InlineData(3, "tercer", null)] + // [InlineData(3, "tercer", null)] [InlineData(3, "tercero", GrammaticalGender.Masculine)] [InlineData(3, "tercera", GrammaticalGender.Feminine)] // [InlineData(11, "once", null)] diff --git a/src/Humanizer.Tests.Shared/Localisation/es/OrdinalizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/es/OrdinalizeTests.cs index d062df0db..0200c2960 100644 --- a/src/Humanizer.Tests.Shared/Localisation/es/OrdinalizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/es/OrdinalizeTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.es { [UseCulture("es-ES")] - public class OrdinalizeTests + public class OrdinalizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/fa/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/fa/DateHumanizeTests.cs index dd3170f2d..0e37ab60c 100644 --- a/src/Humanizer.Tests.Shared/Localisation/fa/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/fa/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.fa { [UseCulture("fa")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(1, "فردا")] @@ -49,7 +49,7 @@ public void MinutesFromNow(int minutes, string expected) [Theory] [InlineData(-1, "یک دقیقه پیش")] [InlineData(-13, "13 دقیقه پیش")] - [InlineData(60,"یک ساعت پیش")] + [InlineData(60, "یک ساعت پیش")] public void MinutesAgo(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); diff --git a/src/Humanizer.Tests.Shared/Localisation/fa/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/fa/NumberToWordsTests.cs index b28e52eb5..30b1aee26 100644 --- a/src/Humanizer.Tests.Shared/Localisation/fa/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/fa/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.fa { [UseCulture("fa")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] [InlineData(1, "یک")] @@ -43,7 +43,7 @@ public void ToWordsFarsi(int number, string expected) [InlineData(1, "اول")] [InlineData(2, "دوم")] [InlineData(3, "سوم")] - [InlineData(4,"چهارم")] + [InlineData(4, "چهارم")] [InlineData(5, "پنجم")] [InlineData(6, "ششم")] [InlineData(7, "هفتم")] diff --git a/src/Humanizer.Tests.Shared/Localisation/fi-FI/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/fi-FI/DateHumanizeTests.cs index 495ad4d0d..4437257a1 100644 --- a/src/Humanizer.Tests.Shared/Localisation/fi-FI/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/fi-FI/DateHumanizeTests.cs @@ -4,12 +4,12 @@ namespace Humanizer.Tests.Localisation.fiFI { [UseCulture("fi-FI")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(2, "2 päivää sitten")] - [InlineData(1, "eilen")] + [InlineData(1, "eilen")] public void DaysAgo(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); diff --git a/src/Humanizer.Tests.Shared/Localisation/fi-FI/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/fi-FI/NumberToWordsTests.cs index ad2be4c73..70b357ae9 100644 --- a/src/Humanizer.Tests.Shared/Localisation/fi-FI/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/fi-FI/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.fiFI { [UseCulture("fi-FI")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/fr-BE/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/fr-BE/DateHumanizeTests.cs index 3dc8ded2d..98aab997b 100644 --- a/src/Humanizer.Tests.Shared/Localisation/fr-BE/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/fr-BE/DateHumanizeTests.cs @@ -4,14 +4,14 @@ namespace Humanizer.Tests.Localisation.frBE { [UseCulture("fr-BE")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(1, "il y a une seconde")] [InlineData(2, "il y a 2 secondes")] [InlineData(10, "il y a 10 secondes")] - public void SecondsAgo(int seconds, string expected) + public void SecondsAgo(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); } @@ -20,7 +20,7 @@ public void SecondsAgo(int seconds, string expected) [InlineData(1, "dans une seconde")] [InlineData(2, "dans 2 secondes")] [InlineData(10, "dans 10 secondes")] - public void SecondsFromNow(int seconds, string expected) + public void SecondsFromNow(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); } @@ -30,7 +30,7 @@ public void SecondsFromNow(int seconds, string expected) [InlineData(2, "il y a 2 minutes")] [InlineData(10, "il y a 10 minutes")] [InlineData(60, "il y a une heure")] - public void MinutesAgo(int minutes, string expected) + public void MinutesAgo(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); } @@ -39,7 +39,7 @@ public void MinutesAgo(int minutes, string expected) [InlineData(1, "dans une minute")] [InlineData(2, "dans 2 minutes")] [InlineData(10, "dans 10 minutes")] - public void MinutesFromNow(int minutes, string expected) + public void MinutesFromNow(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); } @@ -48,7 +48,7 @@ public void MinutesFromNow(int minutes, string expected) [InlineData(1, "il y a une heure")] [InlineData(2, "il y a 2 heures")] [InlineData(10, "il y a 10 heures")] - public void HoursAgo(int hours, string expected) + public void HoursAgo(int hours, string expected) { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Past); } @@ -57,7 +57,7 @@ public void HoursAgo(int hours, string expected) [InlineData(1, "dans une heure")] [InlineData(2, "dans 2 heures")] [InlineData(10, "dans 10 heures")] - public void HoursFromNow(int hours, string expected) + public void HoursFromNow(int hours, string expected) { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); } @@ -66,7 +66,7 @@ public void HoursFromNow(int hours, string expected) [InlineData(1, "hier")] [InlineData(2, "avant-hier")] [InlineData(10, "il y a 10 jours")] - public void DaysAgo(int days, string expected) + public void DaysAgo(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); } @@ -75,7 +75,7 @@ public void DaysAgo(int days, string expected) [InlineData(1, "demain")] [InlineData(2, "après-demain")] [InlineData(10, "dans 10 jours")] - public void DaysFromNow(int days, string expected) + public void DaysFromNow(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); } @@ -84,7 +84,7 @@ public void DaysFromNow(int days, string expected) [InlineData(1, "il y a un mois")] [InlineData(2, "il y a 2 mois")] [InlineData(10, "il y a 10 mois")] - public void MonthsAgo(int months, string expected) + public void MonthsAgo(int months, string expected) { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Past); } @@ -93,7 +93,7 @@ public void MonthsAgo(int months, string expected) [InlineData(1, "dans un mois")] [InlineData(2, "dans 2 mois")] [InlineData(10, "dans 10 mois")] - public void MonthsFromNow(int months, string expected) + public void MonthsFromNow(int months, string expected) { DateHumanize.Verify(expected, months, TimeUnit.Month, Tense.Future); } @@ -101,7 +101,7 @@ public void MonthsFromNow(int months, string expected) [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); } @@ -109,7 +109,7 @@ public void YearsAgo(int years, string expected) [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.Shared/Localisation/fr/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/fr/DateHumanizeTests.cs index 8b9af82f2..0f50f61c2 100644 --- a/src/Humanizer.Tests.Shared/Localisation/fr/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/fr/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.fr { [UseCulture("fr")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/he/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/he/DateHumanizeTests.cs index dfd72f73a..ffde644e6 100644 --- a/src/Humanizer.Tests.Shared/Localisation/he/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/he/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.he { [UseCulture("he")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(1, "אתמול")] diff --git a/src/Humanizer.Tests.Shared/Localisation/hr/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/hr/DateHumanizeTests.cs index d2eef485d..d07e3c2d5 100644 --- a/src/Humanizer.Tests.Shared/Localisation/hr/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/hr/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.hr { [UseCulture("hr-HR")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/hu/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/hu/DateHumanizeTests.cs index 55f511993..d148d4f3d 100644 --- a/src/Humanizer.Tests.Shared/Localisation/hu/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/hu/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.hu { [UseCulture("hu-HU")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(1, "egy másodperce")] diff --git a/src/Humanizer.Tests.Shared/Localisation/invariant/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/invariant/NumberToWordsTests.cs index 646c7483d..7c7716f90 100644 --- a/src/Humanizer.Tests.Shared/Localisation/invariant/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/invariant/NumberToWordsTests.cs @@ -1,10 +1,9 @@ -using System.Globalization; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.invariant { [UseCulture("")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/invariant/ToQuantityTests.cs b/src/Humanizer.Tests.Shared/Localisation/invariant/ToQuantityTests.cs index bbb628d19..c8759f51d 100644 --- a/src/Humanizer.Tests.Shared/Localisation/invariant/ToQuantityTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/invariant/ToQuantityTests.cs @@ -1,10 +1,9 @@ -using System.Globalization; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.invariant { [UseCulture("")] - public class ToQuantityTests + public class ToQuantityTests { [Theory] [InlineData("case", 0, "0 cases")] @@ -22,7 +21,7 @@ public void ToQuantity(string word, int quantity, string expected) { Assert.Equal(expected, word.ToQuantity(quantity)); } - + [Theory] [InlineData("case", 0, "cases")] [InlineData("case", 1, "case")] @@ -39,7 +38,7 @@ public void ToQuantityWithNoQuantity(string word, int quantity, string expected) { Assert.Equal(expected, word.ToQuantity(quantity, ShowQuantityAs.None)); } - + [Theory] [InlineData("case", 0, "0 cases")] [InlineData("case", 1, "1 case")] @@ -54,10 +53,10 @@ public void ToQuantityWithNoQuantity(string word, int quantity, string expected) [InlineData("processes", 1, "1 process")] public void ToQuantityNumeric(string word, int quantity, string expected) { -// ReSharper disable once RedundantArgumentDefaultValue + // ReSharper disable once RedundantArgumentDefaultValue Assert.Equal(expected, word.ToQuantity(quantity, ShowQuantityAs.Numeric)); } - + [Theory] [InlineData("case", 0, "0 cases")] [InlineData("case", 1, "1 case")] diff --git a/src/Humanizer.Tests.Shared/Localisation/it/CollectionFormatterTests.cs b/src/Humanizer.Tests.Shared/Localisation/it/CollectionFormatterTests.cs index caf36a8d7..99d5df0d4 100644 --- a/src/Humanizer.Tests.Shared/Localisation/it/CollectionFormatterTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/it/CollectionFormatterTests.cs @@ -4,13 +4,13 @@ namespace Humanizer.Tests.Localisation.it { [UseCulture("it")] - public class CollectionFormatterTests + public class CollectionFormatterTests { [Fact] public void OneItem() { - var collection = new List(new int[] {1}); + var collection = new List(new int[] { 1 }); var humanized = "1"; Assert.Equal(humanized, collection.Humanize()); } @@ -18,7 +18,7 @@ public void OneItem() [Fact] public void TwoItems() { - var collection = new List(new int[] {1, 2}); + var collection = new List(new int[] { 1, 2 }); var humanized = "1 e 2"; Assert.Equal(humanized, collection.Humanize()); } @@ -26,7 +26,7 @@ public void TwoItems() [Fact] public void MoreThanTwoItems() { - var collection = new List(new int[] {1, 2, 3}); + var collection = new List(new int[] { 1, 2, 3 }); var humanized = "1, 2 e 3"; Assert.Equal(humanized, collection.Humanize()); } diff --git a/src/Humanizer.Tests.Shared/Localisation/it/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/it/DateHumanizeTests.cs index 9f2568694..2ff38a2b7 100644 --- a/src/Humanizer.Tests.Shared/Localisation/it/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/it/DateHumanizeTests.cs @@ -1,11 +1,10 @@ -using System; -using Humanizer.Localisation; +using Humanizer.Localisation; using Xunit; namespace Humanizer.Tests.Localisation.it { [UseCulture("it")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] @@ -16,7 +15,7 @@ public void DaysAgo(int days, string expected) DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); } - [Theory] + [Theory] [InlineData(2, "tra 2 giorni")] [InlineData(1, "domani")] public void DaysFromNow(int days, string expected) diff --git a/src/Humanizer.Tests.Shared/Localisation/it/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/it/NumberToWordsTests.cs index d6db853d3..bc1e1bc55 100644 --- a/src/Humanizer.Tests.Shared/Localisation/it/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/it/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.it { [UseCulture("it")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] @@ -161,7 +161,7 @@ public void ToOrdinalWords(int number, string expected) { Assert.Equal(expected, number.ToOrdinalWords()); } - + [Theory] [InlineData(0, "zero")] [InlineData(1, "prima")] diff --git a/src/Humanizer.Tests.Shared/Localisation/it/OrdinalizerTests.cs b/src/Humanizer.Tests.Shared/Localisation/it/OrdinalizerTests.cs index 86701bb8b..5031cc319 100644 --- a/src/Humanizer.Tests.Shared/Localisation/it/OrdinalizerTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/it/OrdinalizerTests.cs @@ -1,11 +1,9 @@ -using System; -using System.Collections.Generic; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.it { [UseCulture("it")] - public class OrdinalizerTests + public class OrdinalizerTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/ja/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/ja/DateHumanizeTests.cs index d8de1718f..0171ac760 100644 --- a/src/Humanizer.Tests.Shared/Localisation/ja/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/ja/DateHumanizeTests.cs @@ -4,13 +4,13 @@ namespace Humanizer.Tests.Localisation.ja { [UseCulture("ja")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(1, "1 秒前")] [InlineData(2, "2 秒前")] - public void SecondsAgo(int seconds, string expected) + public void SecondsAgo(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); } diff --git a/src/Humanizer.Tests.Shared/Localisation/nb-NO/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/nb-NO/DateHumanizeTests.cs index 02fcec6be..33bff60a1 100644 --- a/src/Humanizer.Tests.Shared/Localisation/nb-NO/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/nb-NO/DateHumanizeTests.cs @@ -4,11 +4,11 @@ namespace Humanizer.Tests.Localisation.nbNO { [UseCulture("nb-NO")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(-2, "2 dager siden")] - [InlineData(-1, "i går")] + [InlineData(-1, "i går")] public void DaysAgo(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); diff --git a/src/Humanizer.Tests.Shared/Localisation/nb/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/nb/DateHumanizeTests.cs index 1df11d408..0000ca087 100644 --- a/src/Humanizer.Tests.Shared/Localisation/nb/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/nb/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.nb { [UseCulture("nb")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/nb/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/nb/NumberToWordsTests.cs index 81dc70514..5c467c892 100644 --- a/src/Humanizer.Tests.Shared/Localisation/nb/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/nb/NumberToWordsTests.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.nb { diff --git a/src/Humanizer.Tests.Shared/Localisation/nl/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/nl/DateHumanizeTests.cs index fff33acdb..23c57c442 100644 --- a/src/Humanizer.Tests.Shared/Localisation/nl/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/nl/DateHumanizeTests.cs @@ -1,11 +1,10 @@ -using System; -using Humanizer.Localisation; +using Humanizer.Localisation; using Xunit; namespace Humanizer.Tests.Localisation.nl { [UseCulture("nl-NL")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs index eeea29d86..4df6a1caf 100644 --- a/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/nl/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.nl { [UseCulture("nl-NL")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/nl/OrdinalizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/nl/OrdinalizeTests.cs index de74b4ff5..b454983cc 100644 --- a/src/Humanizer.Tests.Shared/Localisation/nl/OrdinalizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/nl/OrdinalizeTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.nl { [UseCulture("nl")] - public class OrdinalizeTests + public class OrdinalizeTests { [Theory] @@ -23,6 +23,6 @@ public class OrdinalizeTests public void OrdinalizeString(string number, string ordinalized) { Assert.Equal(number.Ordinalize(), ordinalized); - } - } + } + } } diff --git a/src/Humanizer.Tests.Shared/Localisation/pl/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/pl/DateHumanizeTests.cs index 841ccbccf..5045a4e2a 100644 --- a/src/Humanizer.Tests.Shared/Localisation/pl/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/pl/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.pl { [UseCulture("pl")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/pl/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/pl/NumberToWordsTests.cs index 02ca5481c..2050bc731 100644 --- a/src/Humanizer.Tests.Shared/Localisation/pl/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/pl/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.pl { [UseCulture("pl")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/pt-BR/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/pt-BR/DateHumanizeTests.cs index f237234b5..cb2d1aa9c 100644 --- a/src/Humanizer.Tests.Shared/Localisation/pt-BR/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/pt-BR/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.ptBR { [UseCulture("pt-BR")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/pt-BR/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/pt-BR/NumberToWordsTests.cs index 472dcc619..6fa60e69e 100644 --- a/src/Humanizer.Tests.Shared/Localisation/pt-BR/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/pt-BR/NumberToWordsTests.cs @@ -1,10 +1,9 @@ -using System.Globalization; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.ptBR { [UseCulture("pt-BR")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/pt-BR/OrdinalizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/pt-BR/OrdinalizeTests.cs index 7b9d32c67..76a7b0a1f 100644 --- a/src/Humanizer.Tests.Shared/Localisation/pt-BR/OrdinalizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/pt-BR/OrdinalizeTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.ptBR { [UseCulture("pt-BR")] - public class OrdinalizeTests + public class OrdinalizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/pt/OrdinalizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/pt/OrdinalizeTests.cs index cf45cd8ea..7b52f11ec 100644 --- a/src/Humanizer.Tests.Shared/Localisation/pt/OrdinalizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/pt/OrdinalizeTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.pt { [UseCulture("pt")] - public class OrdinalizeTests + public class OrdinalizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/ro-Ro/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/ro-Ro/DateHumanizeTests.cs index e5a7e6f4c..c08007f36 100644 --- a/src/Humanizer.Tests.Shared/Localisation/ro-Ro/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/ro-Ro/DateHumanizeTests.cs @@ -11,7 +11,7 @@ namespace Humanizer.Tests.Localisation.roRO /// There is no test for months since there are only 12 of them in a year. /// [UseCulture("ro-RO")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] @@ -30,7 +30,7 @@ public void MinutesAgo(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Past); } - + [Theory] [InlineData(2, "acum 2 secunde")] [InlineData(59, "acum 59 de secunde")] @@ -38,7 +38,7 @@ public void SecondsAgo(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Past); } - + [Theory] [InlineData(10, "acum 10 zile")] [InlineData(23, "acum 23 de zile")] @@ -46,7 +46,7 @@ public void DaysAgo(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Past); } - + [Theory] [InlineData(119, "acum 119 ani")] [InlineData(100, "acum 100 de ani")] @@ -54,7 +54,7 @@ public void YearsAgo(int years, string expected) { DateHumanize.Verify(expected, years, TimeUnit.Year, Tense.Past); } - + [Theory] [InlineData(1, "acum")] [InlineData(22, "acum")] @@ -62,7 +62,7 @@ public void MillisecondsAgo(int milliseconds, string expected) { DateHumanize.Verify(expected, milliseconds, TimeUnit.Millisecond, Tense.Past); } - + [Theory] [InlineData(19, "peste 19 secunde")] [InlineData(21, "peste 21 de secunde")] @@ -70,7 +70,7 @@ public void SecondsFromNow(int seconds, string expected) { DateHumanize.Verify(expected, seconds, TimeUnit.Second, Tense.Future); } - + [Theory] [InlineData(19, "peste 19 minute")] [InlineData(22, "peste 22 de minute")] @@ -78,7 +78,7 @@ public void MinutesFromNow(int minutes, string expected) { DateHumanize.Verify(expected, minutes, TimeUnit.Minute, Tense.Future); } - + [Theory] [InlineData(3, "peste 3 ore")] [InlineData(23, "peste 23 de ore")] @@ -94,7 +94,7 @@ public void DaysFromNow(int days, string expected) { DateHumanize.Verify(expected, days, TimeUnit.Day, Tense.Future); } - + [Theory] [InlineData(5, "peste 5 ani")] [InlineData(21, "peste 21 de ani")] diff --git a/src/Humanizer.Tests.Shared/Localisation/ro-Ro/OrdinalizerTests.cs b/src/Humanizer.Tests.Shared/Localisation/ro-Ro/OrdinalizerTests.cs index 873156794..d1e247473 100644 --- a/src/Humanizer.Tests.Shared/Localisation/ro-Ro/OrdinalizerTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/ro-Ro/OrdinalizerTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.roRO { [UseCulture("ro-RO")] - public class OrdinalizerTests + public class OrdinalizerTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/ru-RU/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/ru-RU/NumberToWordsTests.cs index 3bcfe2f1c..8dc34f4ac 100644 --- a/src/Humanizer.Tests.Shared/Localisation/ru-RU/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/ru-RU/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.ruRU { [UseCulture("ru-RU")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] @@ -146,7 +146,7 @@ public void ToOrdinalWords(int number, string expected) { Assert.Equal(expected, number.ToOrdinalWords()); } - + [Theory] [InlineData(0, "нулевая")] [InlineData(1, "первая")] diff --git a/src/Humanizer.Tests.Shared/Localisation/sk/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/sk/DateHumanizeTests.cs index 8ac086644..b5a2659e0 100644 --- a/src/Humanizer.Tests.Shared/Localisation/sk/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/sk/DateHumanizeTests.cs @@ -45,13 +45,13 @@ public void HoursFromNow(int hours, string expected) { DateHumanize.Verify(expected, hours, TimeUnit.Hour, Tense.Future); } - + [Theory] [InlineData(1, "zajtra")] [InlineData(2, "o 2 dni")] [InlineData(3, "o 3 dni")] [InlineData(4, "o 4 dni")] - [InlineData(9, "o 9 dní")] + [InlineData(9, "o 9 dní")] [InlineData(10, "o 10 dní")] public void DaysFromNow(int days, string expected) { diff --git a/src/Humanizer.Tests.Shared/Localisation/sl/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/sl/DateHumanizeTests.cs index d56b27089..e1df6e9bc 100644 --- a/src/Humanizer.Tests.Shared/Localisation/sl/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/sl/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.sl { [UseCulture("sl-SI")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(-10, "pred 10 leti")] diff --git a/src/Humanizer.Tests.Shared/Localisation/sr-Latn/NumberToWordsTest.cs b/src/Humanizer.Tests.Shared/Localisation/sr-Latn/NumberToWordsTest.cs index 33afa2a3e..149414dcc 100644 --- a/src/Humanizer.Tests.Shared/Localisation/sr-Latn/NumberToWordsTest.cs +++ b/src/Humanizer.Tests.Shared/Localisation/sr-Latn/NumberToWordsTest.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.sr_Latn { diff --git a/src/Humanizer.Tests.Shared/Localisation/sr/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/sr/DateHumanizeTests.cs index d708f14be..d72ed6c86 100644 --- a/src/Humanizer.Tests.Shared/Localisation/sr/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/sr/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.sr { [UseCulture("sr")] - public class DateHumanizeDefaultStrategyTests + public class DateHumanizeDefaultStrategyTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/sr/NumberToWordsTest.cs b/src/Humanizer.Tests.Shared/Localisation/sr/NumberToWordsTest.cs index 19c9e38de..ed99df0e2 100644 --- a/src/Humanizer.Tests.Shared/Localisation/sr/NumberToWordsTest.cs +++ b/src/Humanizer.Tests.Shared/Localisation/sr/NumberToWordsTest.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.sr { [UseCulture("sr")] - public class NumberToWordsTest + public class NumberToWordsTest { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/sv/CollectionFormatterTests.cs b/src/Humanizer.Tests.Shared/Localisation/sv/CollectionFormatterTests.cs index f36619a8b..6a326b663 100644 --- a/src/Humanizer.Tests.Shared/Localisation/sv/CollectionFormatterTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/sv/CollectionFormatterTests.cs @@ -9,7 +9,7 @@ public class CollectionFormatterTests [Fact] public void MoreThanTwoItems() { - var collection = new List(new[] {1, 2, 3}); + var collection = new List(new[] { 1, 2, 3 }); var humanized = "1, 2 och 3"; Assert.Equal(humanized, collection.Humanize()); } @@ -17,7 +17,7 @@ public void MoreThanTwoItems() [Fact] public void OneItem() { - var collection = new List(new[] {1}); + var collection = new List(new[] { 1 }); var humanized = "1"; Assert.Equal(humanized, collection.Humanize()); } @@ -25,7 +25,7 @@ public void OneItem() [Fact] public void TwoItems() { - var collection = new List(new[] {1, 2}); + var collection = new List(new[] { 1, 2 }); var humanized = "1 och 2"; Assert.Equal(humanized, collection.Humanize()); } diff --git a/src/Humanizer.Tests.Shared/Localisation/tr/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/tr/DateHumanizeTests.cs index adfe5ec5f..b94a8c209 100644 --- a/src/Humanizer.Tests.Shared/Localisation/tr/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/tr/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.tr { [UseCulture("tr")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs index abf12aaee..e30aa3f0c 100644 --- a/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/tr/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.tr { [UseCulture("tr")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] [InlineData("sıfır", 0)] diff --git a/src/Humanizer.Tests.Shared/Localisation/uk-UA/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/uk-UA/DateHumanizeTests.cs index d87256114..431a745cb 100644 --- a/src/Humanizer.Tests.Shared/Localisation/uk-UA/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/uk-UA/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.ukUA { [UseCulture("uk-UA")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/uk-UA/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/uk-UA/NumberToWordsTests.cs index 8730c9c29..0860db09b 100644 --- a/src/Humanizer.Tests.Shared/Localisation/uk-UA/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/uk-UA/NumberToWordsTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.ukUA { [UseCulture("uk-UA")] - public class NumberToWordsTests + public class NumberToWordsTests { [Theory] [InlineData(0, "нуль")] diff --git a/src/Humanizer.Tests.Shared/Localisation/uk-UA/OrdinalizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/uk-UA/OrdinalizeTests.cs index e5dc94210..b6c4e1bc3 100644 --- a/src/Humanizer.Tests.Shared/Localisation/uk-UA/OrdinalizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/uk-UA/OrdinalizeTests.cs @@ -3,7 +3,7 @@ namespace Humanizer.Tests.Localisation.ukUA { [UseCulture("uk-UA")] - public class OrdinalizeTests + public class OrdinalizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/uz-Cyrl-UZ/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/uz-Cyrl-UZ/DateHumanizeTests.cs index efe63e177..7254bbe37 100644 --- a/src/Humanizer.Tests.Shared/Localisation/uz-Cyrl-UZ/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/uz-Cyrl-UZ/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.uzCyrl { [UseCulture("uz-Cyrl-UZ")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/uz-Latn-UZ/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/uz-Latn-UZ/NumberToWordsTests.cs index 86e45b442..1ec9557a9 100644 --- a/src/Humanizer.Tests.Shared/Localisation/uz-Latn-UZ/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/uz-Latn-UZ/NumberToWordsTests.cs @@ -3,9 +3,9 @@ namespace Humanizer.Tests.Localisation.uzLatn { [UseCulture("uz-Latn-UZ")] - public class NumberToWordsTests + public class NumberToWordsTests { - + [Theory] [InlineData(0, "nol")] [InlineData(1, "bir")] diff --git a/src/Humanizer.Tests.Shared/Localisation/zh-CN/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/zh-CN/DateHumanizeTests.cs index 23ea2b67e..42afd84d5 100644 --- a/src/Humanizer.Tests.Shared/Localisation/zh-CN/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/zh-CN/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.zhCN { [UseCulture("zh-CN")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] diff --git a/src/Humanizer.Tests.Shared/Localisation/zh-CN/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/Localisation/zh-CN/NumberToWordsTests.cs index 4a0d06cf7..8f5740296 100644 --- a/src/Humanizer.Tests.Shared/Localisation/zh-CN/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/zh-CN/NumberToWordsTests.cs @@ -1,10 +1,9 @@ -using System.Globalization; -using Xunit; +using Xunit; namespace Humanizer.Tests.Localisation.zhCN { [UseCulture("zh-CN")] - public class NumberToWordsTests + public class NumberToWordsTests { [InlineData(1, "一")] [InlineData(2, "二")] @@ -37,17 +36,17 @@ public class NumberToWordsTests [InlineData(-54367865, "负 五千四百三十六万七千八百六十五")] [InlineData(650004076, "六亿五千万四千零七十六")] [InlineData(7156404367L, "七十一亿五千六百四十万四千三百六十七")] - [InlineData(89043267890L,"八百九十亿四千三百二十六万七千八百九十")] - [InlineData(500007893401L,"五千亿零七百八十九万三千四百零一")] + [InlineData(89043267890L, "八百九十亿四千三百二十六万七千八百九十")] + [InlineData(500007893401L, "五千亿零七百八十九万三千四百零一")] [InlineData(500000003401L, "五千亿零三千四百零一")] [InlineData(500000000001L, "五千亿零一")] [InlineData(500000000000L, "五千亿")] - [InlineData(6067823149088L,"六兆零六百七十八亿二千三百一十四万九千零八十八")] + [InlineData(6067823149088L, "六兆零六百七十八亿二千三百一十四万九千零八十八")] [Theory] public void ToWords(long number, string expected) { Assert.Equal(expected, number.ToWords()); - } + } [Theory] [InlineData(1, "第 一")] @@ -57,6 +56,6 @@ public void ToWords(long number, string expected) public void ToOrdinalWords(int number, string words) { Assert.Equal(words, number.ToOrdinalWords()); - } + } } } diff --git a/src/Humanizer.Tests.Shared/Localisation/zh-Hans/DateHumanizeTests.cs b/src/Humanizer.Tests.Shared/Localisation/zh-Hans/DateHumanizeTests.cs index defb8700b..11b9fdb84 100644 --- a/src/Humanizer.Tests.Shared/Localisation/zh-Hans/DateHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/Localisation/zh-Hans/DateHumanizeTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests.Localisation.zhHans { [UseCulture("zh-Hans")] - public class DateHumanizeTests + public class DateHumanizeTests { [Theory] [InlineData(2, "2 天前")] diff --git a/src/Humanizer.Tests.Shared/MetricNumeralTests.cs b/src/Humanizer.Tests.Shared/MetricNumeralTests.cs index 0cb2017a8..252a753d2 100644 --- a/src/Humanizer.Tests.Shared/MetricNumeralTests.cs +++ b/src/Humanizer.Tests.Shared/MetricNumeralTests.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using System.Globalization; using System.Linq; -using System.Threading.Tasks; using Xunit; namespace Humanizer.Tests @@ -83,7 +82,10 @@ public void TestAllSymbolsAsInt(int exponent) .FromMetric() .ToString("0.##E+0", CultureInfo.InvariantCulture)); if (!isEquals) + { Debugger.Break(); + } + Assert.True(isEquals); } @@ -104,7 +106,7 @@ public void ToMetric(string expected, double input, bool hasSpace, bool useSymbo Assert.Equal(expected, input.ToMetric(hasSpace, useSymbol, decimals)); } - + [Theory] [InlineData(1E+27)] diff --git a/src/Humanizer.Tests.Shared/NumberToWordsTests.cs b/src/Humanizer.Tests.Shared/NumberToWordsTests.cs index 634019c5d..f79e95a2a 100644 --- a/src/Humanizer.Tests.Shared/NumberToWordsTests.cs +++ b/src/Humanizer.Tests.Shared/NumberToWordsTests.cs @@ -4,7 +4,7 @@ namespace Humanizer.Tests { [UseCulture("en-US")] - public class NumberToWordsTests + public class NumberToWordsTests { [InlineData(1, "one")] [InlineData(10, "ten")] diff --git a/src/Humanizer.Tests.Shared/ResourceKeyTests.cs b/src/Humanizer.Tests.Shared/ResourceKeyTests.cs index 4bfc38901..2eb3d45b2 100644 --- a/src/Humanizer.Tests.Shared/ResourceKeyTests.cs +++ b/src/Humanizer.Tests.Shared/ResourceKeyTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Humanizer.Localisation; using Xunit; diff --git a/src/Humanizer.Tests.Shared/StringHumanizeTests.cs b/src/Humanizer.Tests.Shared/StringHumanizeTests.cs index ae8656d08..6b35eb0d5 100644 --- a/src/Humanizer.Tests.Shared/StringHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/StringHumanizeTests.cs @@ -96,7 +96,7 @@ public void CanHumanizeIntoSentenceCase(string input, string expectedResult) { Assert.Equal(expectedResult, input.Humanize(LetterCasing.Sentence)); } - + [Theory] [InlineData("CanHumanizeIntoUpperCase", "CAN HUMANIZE INTO UPPER CASE")] [InlineData("Can_Humanize_into_Upper_case", "CAN HUMANIZE INTO UPPER CASE")] diff --git a/src/Humanizer.Tests.Shared/TimeSpanHumanizeTests.cs b/src/Humanizer.Tests.Shared/TimeSpanHumanizeTests.cs index f295f597f..77cdf1f9b 100644 --- a/src/Humanizer.Tests.Shared/TimeSpanHumanizeTests.cs +++ b/src/Humanizer.Tests.Shared/TimeSpanHumanizeTests.cs @@ -1,8 +1,8 @@ using System; using System.Globalization; +using System.Linq; using Humanizer.Localisation; using Xunit; -using System.Linq; namespace Humanizer.Tests { @@ -19,7 +19,7 @@ public void AllTimeSpansMustBeUniqueForASequenceOfDays() select text; var grouping = from t in qry group t by t into g - select new { g.Key, Count = g.Count() }; + select new { g.Key, Count = g.Count() }; var allUnique = grouping.All(g => g.Count == 1); Assert.True(allUnique); } diff --git a/src/Humanizer.Tests.Shared/ToQuantityTests.cs b/src/Humanizer.Tests.Shared/ToQuantityTests.cs index a85c2909d..bf942d1ba 100644 --- a/src/Humanizer.Tests.Shared/ToQuantityTests.cs +++ b/src/Humanizer.Tests.Shared/ToQuantityTests.cs @@ -1,6 +1,5 @@ using System; using System.Globalization; -using System.Runtime.InteropServices.ComTypes; using Xunit; namespace Humanizer.Tests @@ -25,7 +24,7 @@ public void ToQuantity(string word, int quantity, string expected) Assert.Equal(expected, word.ToQuantity(quantity)); Assert.Equal(expected, word.ToQuantity((long)quantity)); } - + [Theory] [InlineData("case", 0, "cases")] [InlineData("case", 1, "case")] @@ -43,7 +42,7 @@ public void ToQuantityWithNoQuantity(string word, int quantity, string expected) Assert.Equal(expected, word.ToQuantity(quantity, ShowQuantityAs.None)); Assert.Equal(expected, word.ToQuantity((long)quantity, ShowQuantityAs.None)); } - + [Theory] [InlineData("case", 0, "0 cases")] [InlineData("case", 1, "1 case")] @@ -58,11 +57,11 @@ public void ToQuantityWithNoQuantity(string word, int quantity, string expected) [InlineData("processes", 1, "1 process")] public void ToQuantityNumeric(string word, int quantity, string expected) { -// ReSharper disable once RedundantArgumentDefaultValue + // ReSharper disable once RedundantArgumentDefaultValue Assert.Equal(expected, word.ToQuantity(quantity, ShowQuantityAs.Numeric)); Assert.Equal(expected, word.ToQuantity((long)quantity, ShowQuantityAs.Numeric)); } - + [Theory] [InlineData("case", 0, "zero cases")] [InlineData("case", 1, "one case")] @@ -113,7 +112,7 @@ public void ToQuantityWordsWithCurrentCultureFormatting(string word, int quantit public void ToQuantityWordsWithCustomCultureFormatting(string word, int quantity, string format, string cultureCode, string expected) { var culture = new CultureInfo(cultureCode); - + Assert.Equal(expected, word.ToQuantity(quantity, format, culture), GetStringComparer(culture)); Assert.Equal(expected, word.ToQuantity((long)quantity, format, culture), GetStringComparer(culture)); } diff --git a/src/Humanizer.Tests.Shared/TruncatorTests.cs b/src/Humanizer.Tests.Shared/TruncatorTests.cs index 5319a228c..9289bbb5a 100644 --- a/src/Humanizer.Tests.Shared/TruncatorTests.cs +++ b/src/Humanizer.Tests.Shared/TruncatorTests.cs @@ -39,7 +39,7 @@ public void TruncateWithFixedNumberOfCharactersTruncator(string input, int lengt { Assert.Equal(expectedOutput, input.Truncate(length, Truncator.FixedNumberOfCharacters)); } - + [Theory] [InlineData(null, 10, null)] [InlineData("", 10, "")] @@ -111,8 +111,8 @@ public void TruncateWithTruncationStringAndFixedNumberOfCharactersTruncator(stri public void TruncateWithTruncationStringAndFixedNumberOfWordsTruncator(string input, int length, string truncationString, string expectedOutput) { Assert.Equal(expectedOutput, input.Truncate(length, truncationString, Truncator.FixedNumberOfWords)); - } - + } + [Theory] [InlineData(null, 10, null)] [InlineData("", 10, "")] @@ -123,7 +123,7 @@ public void TruncateWithTruncationStringAndFixedNumberOfWordsTruncator(string in public void TruncateWithFixedLengthTruncatorTruncateFromLeft(string input, int length, string expectedOutput) { Assert.Equal(expectedOutput, input.Truncate(length, Truncator.FixedLength, TruncateFrom.Left)); - } + } [Theory] [InlineData(null, 10, null)] diff --git a/src/Humanizer.Tests.Shared/UseCultureAttribute.cs b/src/Humanizer.Tests.Shared/UseCultureAttribute.cs index 328a60537..36ed1f504 100644 --- a/src/Humanizer.Tests.Shared/UseCultureAttribute.cs +++ b/src/Humanizer.Tests.Shared/UseCultureAttribute.cs @@ -1,14 +1,12 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.Reflection; -using System.Text; using System.Threading; using Xunit.Sdk; namespace Humanizer.Tests { - + /// /// Apply this attribute to your test method to replace the /// and @@ -17,11 +15,10 @@ namespace Humanizer.Tests [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class UseCultureAttribute : BeforeAfterTestAttribute { - readonly Lazy culture; - readonly Lazy uiCulture; - - CultureInfo originalCulture; - CultureInfo originalUICulture; + private readonly Lazy culture; + private readonly Lazy uiCulture; + private CultureInfo originalCulture; + private CultureInfo originalUICulture; /// diff --git a/src/Humanizer.Tests/ApiApprover/DiffPlexReporter.cs b/src/Humanizer.Tests/ApiApprover/DiffPlexReporter.cs index a07c7680e..1802255e3 100644 --- a/src/Humanizer.Tests/ApiApprover/DiffPlexReporter.cs +++ b/src/Humanizer.Tests/ApiApprover/DiffPlexReporter.cs @@ -3,11 +3,11 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. +using System.IO; using ApprovalTests.Core; using DiffPlex; using DiffPlex.DiffBuilder; using DiffPlex.DiffBuilder.Model; -using System.IO; using Xunit.Abstractions; namespace Humanizer.Tests.ApiApprover @@ -28,7 +28,10 @@ public void Report(string approved, string received) foreach (var line in diff.Lines) { - if (line.Type == ChangeType.Unchanged) continue; + if (line.Type == ChangeType.Unchanged) + { + continue; + } var prefix = " "; switch (line.Type) diff --git a/src/Humanizer/Bytes/ByteRate.cs b/src/Humanizer/Bytes/ByteRate.cs index 025cbe5a0..67534eeca 100644 --- a/src/Humanizer/Bytes/ByteRate.cs +++ b/src/Humanizer/Bytes/ByteRate.cs @@ -13,7 +13,7 @@ public class ByteRate /// Quantity of bytes /// /// - public ByteSize Size { get; private set;} + public ByteSize Size { get; private set; } /// /// Interval that bytes were transferred in @@ -69,7 +69,9 @@ public string Humanize(string format, TimeUnit timeUnit = TimeUnit.Second) displayUnit = "hour"; } else + { throw new NotSupportedException("timeUnit must be Second, Minute, or Hour"); + } return new ByteSize(Size.Bytes / Interval.TotalSeconds * displayInterval.TotalSeconds) .Humanize(format) + '/' + displayUnit; diff --git a/src/Humanizer/Bytes/ByteSize.cs b/src/Humanizer/Bytes/ByteSize.cs index d4980059a..1c65f8d89 100644 --- a/src/Humanizer/Bytes/ByteSize.cs +++ b/src/Humanizer/Bytes/ByteSize.cs @@ -59,19 +59,29 @@ public string LargestWholeNumberSymbol { // Absolute value is used to deal with negative values if (Math.Abs(Terabytes) >= 1) + { return TerabyteSymbol; + } if (Math.Abs(Gigabytes) >= 1) + { return GigabyteSymbol; + } if (Math.Abs(Megabytes) >= 1) + { return MegabyteSymbol; + } if (Math.Abs(Kilobytes) >= 1) + { return KilobyteSymbol; + } if (Math.Abs(Bytes) >= 1) + { return ByteSymbol; + } return BitSymbol; } @@ -82,19 +92,29 @@ public double LargestWholeNumberValue { // Absolute value is used to deal with negative values if (Math.Abs(Terabytes) >= 1) + { return Terabytes; + } if (Math.Abs(Gigabytes) >= 1) + { return Gigabytes; + } if (Math.Abs(Megabytes) >= 1) + { return Megabytes; + } if (Math.Abs(Kilobytes) >= 1) + { return Kilobytes; + } if (Math.Abs(Bytes) >= 1) + { return Bytes; + } return Bits; } @@ -157,26 +177,43 @@ public override string ToString() public string ToString(string format) { if (!format.Contains("#") && !format.Contains("0")) + { format = "0.## " + format; + } bool has(string s) => format.IndexOf(s, StringComparison.CurrentCultureIgnoreCase) != -1; string output(double n) => n.ToString(format); if (has(TerabyteSymbol)) + { return output(Terabytes); + } + if (has(GigabyteSymbol)) + { return output(Gigabytes); + } + if (has(MegabyteSymbol)) + { return output(Megabytes); + } + if (has(KilobyteSymbol)) + { return output(Kilobytes); + } // Byte and Bit symbol look must be case-sensitive if (format.IndexOf(ByteSymbol, StringComparison.Ordinal) != -1) + { return output(Bytes); + } if (format.IndexOf(BitSymbol, StringComparison.Ordinal) != -1) + { return output(Bits); + } var formattedLargeWholeNumberValue = LargestWholeNumberValue.ToString(format); @@ -190,13 +227,19 @@ public string ToString(string format) public override bool Equals(object value) { if (value == null) + { return false; + } ByteSize other; if (value is ByteSize) + { other = (ByteSize)value; + } else + { return false; + } return Equals(other); } @@ -214,12 +257,16 @@ public override int GetHashCode() public int CompareTo(object obj) { if (obj == null) + { return 1; + } if (!(obj is ByteSize)) + { throw new ArgumentException("Object is not a ByteSize"); + } - return CompareTo((ByteSize) obj); + return CompareTo((ByteSize)obj); } public int CompareTo(ByteSize other) @@ -321,7 +368,9 @@ public static bool TryParse(string s, out ByteSize result) { // Arg checking if (string.IsNullOrWhiteSpace(s)) + { throw new ArgumentNullException(nameof(s), "String is null or whitespace"); + } // Setup the result result = new ByteSize(); @@ -333,18 +382,22 @@ public static bool TryParse(string s, out ByteSize result) var found = false; // Acquiring culture specific decimal separator - var decSep = Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); - + var decSep = Convert.ToChar(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); + // Pick first non-digit number for (num = 0; num < s.Length; num++) + { if (!(char.IsDigit(s[num]) || s[num] == decSep)) { found = true; break; } + } if (found == false) + { return false; + } var lastNumber = num; @@ -354,7 +407,9 @@ public static bool TryParse(string s, out ByteSize result) // Get the numeric part if (!double.TryParse(numberPart, out var number)) + { return false; + } // Get the magnitude part switch (sizePart.ToUpper()) @@ -363,7 +418,9 @@ public static bool TryParse(string s, out ByteSize result) if (sizePart == BitSymbol) { // Bits if (number % 1 != 0) // Can't have partial bits + { return false; + } result = FromBits((long)number); } @@ -396,7 +453,9 @@ public static bool TryParse(string s, out ByteSize result) public static ByteSize Parse(string s) { if (TryParse(s, out var result)) + { return result; + } throw new FormatException("Value is not in the correct format"); } diff --git a/src/Humanizer/CollectionHumanizeExtensions.cs b/src/Humanizer/CollectionHumanizeExtensions.cs index 2823433c8..fb9fd4076 100644 --- a/src/Humanizer/CollectionHumanizeExtensions.cs +++ b/src/Humanizer/CollectionHumanizeExtensions.cs @@ -26,7 +26,9 @@ public static string Humanize(this IEnumerable collection) public static string Humanize(this IEnumerable collection, Func displayFormatter) { if (displayFormatter == null) + { throw new ArgumentNullException(nameof(displayFormatter)); + } return Configurator.CollectionFormatter.Humanize(collection, displayFormatter); } @@ -38,7 +40,9 @@ public static string Humanize(this IEnumerable collection, Func public static string Humanize(this IEnumerable collection, Func displayFormatter) { if (displayFormatter == null) + { throw new ArgumentNullException(nameof(displayFormatter)); + } return Configurator.CollectionFormatter.Humanize(collection, displayFormatter); } @@ -60,7 +64,9 @@ public static string Humanize(this IEnumerable collection, string separato public static string Humanize(this IEnumerable collection, Func displayFormatter, string separator) { if (displayFormatter == null) + { throw new ArgumentNullException(nameof(displayFormatter)); + } return Configurator.CollectionFormatter.Humanize(collection, displayFormatter, separator); } @@ -72,7 +78,9 @@ public static string Humanize(this IEnumerable collection, Func public static string Humanize(this IEnumerable collection, Func displayFormatter, string separator) { if (displayFormatter == null) + { throw new ArgumentNullException(nameof(displayFormatter)); + } return Configurator.CollectionFormatter.Humanize(collection, displayFormatter, separator); } diff --git a/src/Humanizer/Configuration/Configurator.cs b/src/Humanizer/Configuration/Configurator.cs index 933010f8d..15b56bb4a 100644 --- a/src/Humanizer/Configuration/Configurator.cs +++ b/src/Humanizer/Configuration/Configurator.cs @@ -1,13 +1,12 @@ using System; -using System.Collections.Generic; using System.Globalization; using System.Reflection; using Humanizer.DateTimeHumanizeStrategy; +using Humanizer.Localisation.CollectionFormatters; +using Humanizer.Localisation.DateToOrdinalWords; using Humanizer.Localisation.Formatters; using Humanizer.Localisation.NumberToWords; using Humanizer.Localisation.Ordinalizers; -using Humanizer.Localisation.CollectionFormatters; -using Humanizer.Localisation.DateToOrdinalWords; namespace Humanizer.Configuration { diff --git a/src/Humanizer/Configuration/LocaliserRegistry.cs b/src/Humanizer/Configuration/LocaliserRegistry.cs index 557bd0ce5..2c8edfa08 100644 --- a/src/Humanizer/Configuration/LocaliserRegistry.cs +++ b/src/Humanizer/Configuration/LocaliserRegistry.cs @@ -65,12 +65,14 @@ public void Register(string localeCode, Func localiser) _localisers[localeCode] = localiser; } - Func FindLocaliser(CultureInfo culture) + private Func FindLocaliser(CultureInfo culture) { for (var c = culture; !string.IsNullOrEmpty(c?.Name); c = c.Parent) { if (_localisers.TryGetValue(c.Name, out var localiser)) + { return localiser; + } } return _defaultLocaliser; diff --git a/src/Humanizer/DateHumanizeExtensions.cs b/src/Humanizer/DateHumanizeExtensions.cs index c5a2308cb..7047b2f69 100644 --- a/src/Humanizer/DateHumanizeExtensions.cs +++ b/src/Humanizer/DateHumanizeExtensions.cs @@ -22,7 +22,9 @@ public static string Humanize(this DateTime input, bool utcDate = true, DateTime var comparisonBase = dateToCompareAgainst ?? DateTime.UtcNow; if (!utcDate) + { comparisonBase = comparisonBase.ToLocalTime(); + } return Configurator.DateTimeHumanizeStrategy.Humanize(input, comparisonBase, culture); } @@ -38,11 +40,15 @@ public static string Humanize(this DateTime input, bool utcDate = true, DateTime public static string Humanize(this DateTime? input, bool utcDate = true, DateTime? dateToCompareAgainst = null, CultureInfo culture = null) { if (input.HasValue) + { return Humanize(input.Value, utcDate, dateToCompareAgainst, culture); + } else - return Configurator.GetFormatter(culture).DateHumanize_Never(); + { + return Configurator.GetFormatter(culture).DateHumanize_Never(); + } } - + /// /// Turns the current or provided date into a human readable sentence /// @@ -67,9 +73,13 @@ public static string Humanize(this DateTimeOffset input, DateTimeOffset? dateToC public static string Humanize(this DateTimeOffset? input, DateTimeOffset? dateToCompareAgainst = null, CultureInfo culture = null) { if (input.HasValue) + { return Humanize(input.Value, dateToCompareAgainst, culture); + } else + { return Configurator.GetFormatter(culture).DateHumanize_Never(); + } } } } \ No newline at end of file diff --git a/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs b/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs index 080e5f29b..1b25eea6e 100644 --- a/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs +++ b/src/Humanizer/DateTimeHumanizeStrategy/DateTimeHumanizeAlgorithms.cs @@ -22,13 +22,32 @@ public static string PrecisionHumanize(DateTime input, DateTime comparisonBase, int years = 0, months = 0; // start approximate from smaller units towards bigger ones - if (ts.Milliseconds >= 999 * precision) seconds += 1; - if (seconds >= 59 * precision) minutes += 1; - if (minutes >= 59 * precision) hours += 1; - if (hours >= 23 * precision) days += 1; + if (ts.Milliseconds >= 999 * precision) + { + seconds += 1; + } + + if (seconds >= 59 * precision) + { + minutes += 1; + } + + if (minutes >= 59 * precision) + { + hours += 1; + } + + if (hours >= 23 * precision) + { + days += 1; + } // month calculation - if (days >= 30 * precision & days <= 31) months = 1; + if (days >= 30 * precision & days <= 31) + { + months = 1; + } + if (days > 31 && days < 365 * precision) { var factor = Convert.ToInt32(Math.Floor((double)days / 30)); @@ -37,7 +56,11 @@ public static string PrecisionHumanize(DateTime input, DateTime comparisonBase, } // year calculation - if (days >= 365 * precision && days <= 366) years = 1; + if (days >= 365 * precision && days <= 366) + { + years = 1; + } + if (days > 365) { var factor = Convert.ToInt32(Math.Floor((double)days / 365)); @@ -47,12 +70,36 @@ public static string PrecisionHumanize(DateTime input, DateTime comparisonBase, // start computing result from larger units to smaller ones var formatter = Configurator.GetFormatter(culture); - if (years > 0) return formatter.DateHumanize(TimeUnit.Year, tense, years); - if (months > 0) return formatter.DateHumanize(TimeUnit.Month, tense, months); - if (days > 0) return formatter.DateHumanize(TimeUnit.Day, tense, days); - if (hours > 0) return formatter.DateHumanize(TimeUnit.Hour, tense, hours); - if (minutes > 0) return formatter.DateHumanize(TimeUnit.Minute, tense, minutes); - if (seconds > 0) return formatter.DateHumanize(TimeUnit.Second, tense, seconds); + if (years > 0) + { + return formatter.DateHumanize(TimeUnit.Year, tense, years); + } + + if (months > 0) + { + return formatter.DateHumanize(TimeUnit.Month, tense, months); + } + + if (days > 0) + { + return formatter.DateHumanize(TimeUnit.Day, tense, days); + } + + if (hours > 0) + { + return formatter.DateHumanize(TimeUnit.Hour, tense, hours); + } + + if (minutes > 0) + { + return formatter.DateHumanize(TimeUnit.Minute, tense, minutes); + } + + if (seconds > 0) + { + return formatter.DateHumanize(TimeUnit.Second, tense, seconds); + } + return formatter.DateHumanize(TimeUnit.Millisecond, tense, 0); } @@ -68,22 +115,34 @@ public static string DefaultHumanize(DateTime input, DateTime comparisonBase, Cu var formatter = Configurator.GetFormatter(culture); if (ts.TotalMilliseconds < 500) + { return formatter.DateHumanize(TimeUnit.Millisecond, tense, 0); + } if (ts.TotalSeconds < 60) + { return formatter.DateHumanize(TimeUnit.Second, tense, ts.Seconds); + } if (ts.TotalSeconds < 120) + { return formatter.DateHumanize(TimeUnit.Minute, tense, 1); + } if (ts.TotalMinutes < 60) + { return formatter.DateHumanize(TimeUnit.Minute, tense, ts.Minutes); + } if (ts.TotalMinutes < 90) + { return formatter.DateHumanize(TimeUnit.Hour, tense, 1); + } if (ts.TotalHours < 24) + { return formatter.DateHumanize(TimeUnit.Hour, tense, ts.Hours); + } if (ts.TotalHours < 48) { @@ -92,12 +151,17 @@ public static string DefaultHumanize(DateTime input, DateTime comparisonBase, Cu } if (ts.TotalDays < 28) + { return formatter.DateHumanize(TimeUnit.Day, tense, ts.Days); + } if (ts.TotalDays >= 28 && ts.TotalDays < 30) { if (comparisonBase.Date.AddMonths(tense == Tense.Future ? 1 : -1) == input.Date) + { return formatter.DateHumanize(TimeUnit.Month, tense, 1); + } + return formatter.DateHumanize(TimeUnit.Day, tense, ts.Days); } @@ -108,7 +172,10 @@ public static string DefaultHumanize(DateTime input, DateTime comparisonBase, Cu } var years = Convert.ToInt32(Math.Floor(ts.TotalDays / 365)); - if (years == 0) years = 1; + if (years == 0) + { + years = 1; + } return formatter.DateHumanize(TimeUnit.Year, tense, years); } diff --git a/src/Humanizer/DateTimeHumanizeStrategy/PrecisionDateTimeOffsetHumanizeStrategy.cs b/src/Humanizer/DateTimeHumanizeStrategy/PrecisionDateTimeOffsetHumanizeStrategy.cs index 5b1738b5f..088a716d4 100644 --- a/src/Humanizer/DateTimeHumanizeStrategy/PrecisionDateTimeOffsetHumanizeStrategy.cs +++ b/src/Humanizer/DateTimeHumanizeStrategy/PrecisionDateTimeOffsetHumanizeStrategy.cs @@ -6,7 +6,7 @@ namespace Humanizer.DateTimeHumanizeStrategy /// /// Precision-based calculator for distance between two times /// - public class PrecisionDateTimeOffsetHumanizeStrategy : IDateTimeOffsetHumanizeStrategy + public class PrecisionDateTimeOffsetHumanizeStrategy : IDateTimeOffsetHumanizeStrategy { private readonly double _precision; diff --git a/src/Humanizer/DateToOrdinalWordsExtensions.cs b/src/Humanizer/DateToOrdinalWordsExtensions.cs index ac60ba244..afb297389 100644 --- a/src/Humanizer/DateToOrdinalWordsExtensions.cs +++ b/src/Humanizer/DateToOrdinalWordsExtensions.cs @@ -1,5 +1,4 @@ using System; -using System.Globalization; using Humanizer.Configuration; namespace Humanizer diff --git a/src/Humanizer/EnumDehumanizeExtensions.cs b/src/Humanizer/EnumDehumanizeExtensions.cs index 157b30141..f025c877e 100644 --- a/src/Humanizer/EnumDehumanizeExtensions.cs +++ b/src/Humanizer/EnumDehumanizeExtensions.cs @@ -41,7 +41,9 @@ private static object DehumanizeToPrivate(string input, Type targetEnum, OnNoMat var match = Enum.GetValues(targetEnum).Cast().FirstOrDefault(value => string.Equals(value.Humanize(), input, StringComparison.OrdinalIgnoreCase)); if (match == null && onNoMatch == OnNoMatch.ThrowsException) + { throw new NoMatchFoundException("Couldn't find any enum member that matches the string " + input); + } return match; } diff --git a/src/Humanizer/EnumHumanizeExtensions.cs b/src/Humanizer/EnumHumanizeExtensions.cs index 09ae2a1dc..073bcd5ec 100644 --- a/src/Humanizer/EnumHumanizeExtensions.cs +++ b/src/Humanizer/EnumHumanizeExtensions.cs @@ -2,7 +2,6 @@ using System.Linq; using System.Reflection; using Humanizer.Configuration; -using System.Collections.Generic; namespace Humanizer { @@ -45,7 +44,9 @@ public static string Humanize(this Enum input) var customDescription = GetCustomDescription(memInfo); if (customDescription != null) + { return customDescription; + } } return caseName.Humanize(); @@ -75,13 +76,19 @@ private static string GetCustomDescription(MemberInfo memberInfo) if (methodGetDescription != null) { var executedMethod = methodGetDescription.Invoke(attr, new object[0]); - if (executedMethod != null) return executedMethod.ToString(); + if (executedMethod != null) + { + return executedMethod.ToString(); + } } var methodGetName = attrType.GetRuntimeMethod(DisplayAttributeGetNameMethodName, new Type[0]); if (methodGetName != null) { var executedMethod = methodGetName.Invoke(attr, new object[0]); - if (executedMethod != null) return executedMethod.ToString(); + if (executedMethod != null) + { + return executedMethod.ToString(); + } } return null; } @@ -91,7 +98,9 @@ private static string GetCustomDescription(MemberInfo memberInfo) .Where(StringTypedProperty) .FirstOrDefault(Configurator.EnumDescriptionPropertyLocator); if (descriptionProperty != null) + { return descriptionProperty.GetValue(attr, null).ToString(); + } } return null; diff --git a/src/Humanizer/FluentDate/In.Months.cs b/src/Humanizer/FluentDate/In.Months.cs index 3e8cf85db..9ab7f9e96 100644 --- a/src/Humanizer/FluentDate/In.Months.cs +++ b/src/Humanizer/FluentDate/In.Months.cs @@ -1,201 +1,201 @@ - + using System; namespace Humanizer { public partial class In { - + /// /// Returns 1st of January of the current year /// - public static DateTime January - { - get { return new DateTime(DateTime.UtcNow.Year, 1, 1); } - } + public static DateTime January + { + get { return new DateTime(DateTime.UtcNow.Year, 1, 1); } + } /// /// Returns 1st of January of the year passed in /// public static DateTime JanuaryOf(int year) - { - return new DateTime(year, 1, 1); - } - + { + return new DateTime(year, 1, 1); + } + /// /// Returns 1st of February of the current year /// - public static DateTime February - { - get { return new DateTime(DateTime.UtcNow.Year, 2, 1); } - } + public static DateTime February + { + get { return new DateTime(DateTime.UtcNow.Year, 2, 1); } + } /// /// Returns 1st of February of the year passed in /// public static DateTime FebruaryOf(int year) - { - return new DateTime(year, 2, 1); - } - + { + return new DateTime(year, 2, 1); + } + /// /// Returns 1st of March of the current year /// - public static DateTime March - { - get { return new DateTime(DateTime.UtcNow.Year, 3, 1); } - } + public static DateTime March + { + get { return new DateTime(DateTime.UtcNow.Year, 3, 1); } + } /// /// Returns 1st of March of the year passed in /// public static DateTime MarchOf(int year) - { - return new DateTime(year, 3, 1); - } - + { + return new DateTime(year, 3, 1); + } + /// /// Returns 1st of April of the current year /// - public static DateTime April - { - get { return new DateTime(DateTime.UtcNow.Year, 4, 1); } - } + public static DateTime April + { + get { return new DateTime(DateTime.UtcNow.Year, 4, 1); } + } /// /// Returns 1st of April of the year passed in /// public static DateTime AprilOf(int year) - { - return new DateTime(year, 4, 1); - } - + { + return new DateTime(year, 4, 1); + } + /// /// Returns 1st of May of the current year /// - public static DateTime May - { - get { return new DateTime(DateTime.UtcNow.Year, 5, 1); } - } + public static DateTime May + { + get { return new DateTime(DateTime.UtcNow.Year, 5, 1); } + } /// /// Returns 1st of May of the year passed in /// public static DateTime MayOf(int year) - { - return new DateTime(year, 5, 1); - } - + { + return new DateTime(year, 5, 1); + } + /// /// Returns 1st of June of the current year /// - public static DateTime June - { - get { return new DateTime(DateTime.UtcNow.Year, 6, 1); } - } + public static DateTime June + { + get { return new DateTime(DateTime.UtcNow.Year, 6, 1); } + } /// /// Returns 1st of June of the year passed in /// public static DateTime JuneOf(int year) - { - return new DateTime(year, 6, 1); - } - + { + return new DateTime(year, 6, 1); + } + /// /// Returns 1st of July of the current year /// - public static DateTime July - { - get { return new DateTime(DateTime.UtcNow.Year, 7, 1); } - } + public static DateTime July + { + get { return new DateTime(DateTime.UtcNow.Year, 7, 1); } + } /// /// Returns 1st of July of the year passed in /// public static DateTime JulyOf(int year) - { - return new DateTime(year, 7, 1); - } - + { + return new DateTime(year, 7, 1); + } + /// /// Returns 1st of August of the current year /// - public static DateTime August - { - get { return new DateTime(DateTime.UtcNow.Year, 8, 1); } - } + public static DateTime August + { + get { return new DateTime(DateTime.UtcNow.Year, 8, 1); } + } /// /// Returns 1st of August of the year passed in /// public static DateTime AugustOf(int year) - { - return new DateTime(year, 8, 1); - } - + { + return new DateTime(year, 8, 1); + } + /// /// Returns 1st of September of the current year /// - public static DateTime September - { - get { return new DateTime(DateTime.UtcNow.Year, 9, 1); } - } + public static DateTime September + { + get { return new DateTime(DateTime.UtcNow.Year, 9, 1); } + } /// /// Returns 1st of September of the year passed in /// public static DateTime SeptemberOf(int year) - { - return new DateTime(year, 9, 1); - } - + { + return new DateTime(year, 9, 1); + } + /// /// Returns 1st of October of the current year /// - public static DateTime October - { - get { return new DateTime(DateTime.UtcNow.Year, 10, 1); } - } + public static DateTime October + { + get { return new DateTime(DateTime.UtcNow.Year, 10, 1); } + } /// /// Returns 1st of October of the year passed in /// public static DateTime OctoberOf(int year) - { - return new DateTime(year, 10, 1); - } - + { + return new DateTime(year, 10, 1); + } + /// /// Returns 1st of November of the current year /// - public static DateTime November - { - get { return new DateTime(DateTime.UtcNow.Year, 11, 1); } - } + public static DateTime November + { + get { return new DateTime(DateTime.UtcNow.Year, 11, 1); } + } /// /// Returns 1st of November of the year passed in /// public static DateTime NovemberOf(int year) - { - return new DateTime(year, 11, 1); - } - + { + return new DateTime(year, 11, 1); + } + /// /// Returns 1st of December of the current year /// - public static DateTime December - { - get { return new DateTime(DateTime.UtcNow.Year, 12, 1); } - } + public static DateTime December + { + get { return new DateTime(DateTime.UtcNow.Year, 12, 1); } + } /// /// Returns 1st of December of the year passed in /// public static DateTime DecemberOf(int year) - { - return new DateTime(year, 12, 1); - } - } + { + return new DateTime(year, 12, 1); + } + } } \ No newline at end of file diff --git a/src/Humanizer/FluentDate/In.SomeTimeFrom.cs b/src/Humanizer/FluentDate/In.SomeTimeFrom.cs index cac1da132..8cf1979bf 100644 --- a/src/Humanizer/FluentDate/In.SomeTimeFrom.cs +++ b/src/Humanizer/FluentDate/In.SomeTimeFrom.cs @@ -1,4 +1,4 @@ - + using System; namespace Humanizer @@ -7,1175 +7,1175 @@ namespace Humanizer /// public partial class In { - + /// /// - public static class One - { - /// - /// 1 seconds from now - /// - public static DateTime Second - { - get { return DateTime.UtcNow.AddSeconds(1); } - } - - /// - /// 1 seconds from the provided date - /// - public static DateTime SecondFrom(DateTime date) - { - return date.AddSeconds(1); - } - - /// - /// 1 minutes from now - /// - public static DateTime Minute - { - get { return DateTime.UtcNow.AddMinutes(1); } - } - - /// - /// 1 minutes from the provided date - /// - public static DateTime MinuteFrom(DateTime date) - { - return date.AddMinutes(1); - } - - /// - /// 1 hours from now - /// - public static DateTime Hour - { - get { return DateTime.UtcNow.AddHours(1); } - } - - /// - /// 1 hours from the provided date - /// - public static DateTime HourFrom(DateTime date) - { - return date.AddHours(1); - } - - /// - /// 1 days from now - /// - public static DateTime Day - { - get { return DateTime.UtcNow.AddDays(1); } - } - - /// - /// 1 days from the provided date - /// - public static DateTime DayFrom(DateTime date) - { - return date.AddDays(1); - } - - /// - /// 1 weeks from now - /// - public static DateTime Week - { - get { return DateTime.UtcNow.AddDays(7); } - } - - /// - /// 1 weeks from the provided date - /// - public static DateTime WeekFrom(DateTime date) - { - return date.AddDays(7); - } - - /// - /// 1 months from now - /// - public static DateTime Month - { - get { return DateTime.UtcNow.AddMonths(1); } - } - - /// - /// 1 months from the provided date - /// - public static DateTime MonthFrom(DateTime date) - { - return date.AddMonths(1); - } - - /// - /// 1 years from now - /// - public static DateTime Year - { - get { return DateTime.UtcNow.AddYears(1); } - } - - /// - /// 1 years from the provided date - /// - public static DateTime YearFrom(DateTime date) - { - return date.AddYears(1); - } - } - + public static class One + { + /// + /// 1 seconds from now + /// + public static DateTime Second + { + get { return DateTime.UtcNow.AddSeconds(1); } + } + + /// + /// 1 seconds from the provided date + /// + public static DateTime SecondFrom(DateTime date) + { + return date.AddSeconds(1); + } + + /// + /// 1 minutes from now + /// + public static DateTime Minute + { + get { return DateTime.UtcNow.AddMinutes(1); } + } + + /// + /// 1 minutes from the provided date + /// + public static DateTime MinuteFrom(DateTime date) + { + return date.AddMinutes(1); + } + + /// + /// 1 hours from now + /// + public static DateTime Hour + { + get { return DateTime.UtcNow.AddHours(1); } + } + + /// + /// 1 hours from the provided date + /// + public static DateTime HourFrom(DateTime date) + { + return date.AddHours(1); + } + + /// + /// 1 days from now + /// + public static DateTime Day + { + get { return DateTime.UtcNow.AddDays(1); } + } + + /// + /// 1 days from the provided date + /// + public static DateTime DayFrom(DateTime date) + { + return date.AddDays(1); + } + + /// + /// 1 weeks from now + /// + public static DateTime Week + { + get { return DateTime.UtcNow.AddDays(7); } + } + + /// + /// 1 weeks from the provided date + /// + public static DateTime WeekFrom(DateTime date) + { + return date.AddDays(7); + } + + /// + /// 1 months from now + /// + public static DateTime Month + { + get { return DateTime.UtcNow.AddMonths(1); } + } + + /// + /// 1 months from the provided date + /// + public static DateTime MonthFrom(DateTime date) + { + return date.AddMonths(1); + } + + /// + /// 1 years from now + /// + public static DateTime Year + { + get { return DateTime.UtcNow.AddYears(1); } + } + + /// + /// 1 years from the provided date + /// + public static DateTime YearFrom(DateTime date) + { + return date.AddYears(1); + } + } + /// /// - public static class Two - { - /// - /// 2 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(2); } - } - - /// - /// 2 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(2); - } - - /// - /// 2 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(2); } - } - - /// - /// 2 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(2); - } - - /// - /// 2 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(2); } - } - - /// - /// 2 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(2); - } - - /// - /// 2 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(2); } - } - - /// - /// 2 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(2); - } - - /// - /// 2 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(14); } - } - - /// - /// 2 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(14); - } - - /// - /// 2 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(2); } - } - - /// - /// 2 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(2); - } - - /// - /// 2 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(2); } - } - - /// - /// 2 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(2); - } - } - + public static class Two + { + /// + /// 2 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(2); } + } + + /// + /// 2 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(2); + } + + /// + /// 2 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(2); } + } + + /// + /// 2 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(2); + } + + /// + /// 2 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(2); } + } + + /// + /// 2 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(2); + } + + /// + /// 2 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(2); } + } + + /// + /// 2 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(2); + } + + /// + /// 2 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(14); } + } + + /// + /// 2 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(14); + } + + /// + /// 2 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(2); } + } + + /// + /// 2 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(2); + } + + /// + /// 2 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(2); } + } + + /// + /// 2 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(2); + } + } + /// /// - public static class Three - { - /// - /// 3 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(3); } - } - - /// - /// 3 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(3); - } - - /// - /// 3 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(3); } - } - - /// - /// 3 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(3); - } - - /// - /// 3 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(3); } - } - - /// - /// 3 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(3); - } - - /// - /// 3 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(3); } - } - - /// - /// 3 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(3); - } - - /// - /// 3 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(21); } - } - - /// - /// 3 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(21); - } - - /// - /// 3 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(3); } - } - - /// - /// 3 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(3); - } - - /// - /// 3 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(3); } - } - - /// - /// 3 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(3); - } - } - + public static class Three + { + /// + /// 3 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(3); } + } + + /// + /// 3 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(3); + } + + /// + /// 3 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(3); } + } + + /// + /// 3 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(3); + } + + /// + /// 3 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(3); } + } + + /// + /// 3 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(3); + } + + /// + /// 3 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(3); } + } + + /// + /// 3 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(3); + } + + /// + /// 3 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(21); } + } + + /// + /// 3 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(21); + } + + /// + /// 3 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(3); } + } + + /// + /// 3 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(3); + } + + /// + /// 3 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(3); } + } + + /// + /// 3 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(3); + } + } + /// /// - public static class Four - { - /// - /// 4 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(4); } - } - - /// - /// 4 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(4); - } - - /// - /// 4 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(4); } - } - - /// - /// 4 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(4); - } - - /// - /// 4 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(4); } - } - - /// - /// 4 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(4); - } - - /// - /// 4 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(4); } - } - - /// - /// 4 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(4); - } - - /// - /// 4 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(28); } - } - - /// - /// 4 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(28); - } - - /// - /// 4 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(4); } - } - - /// - /// 4 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(4); - } - - /// - /// 4 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(4); } - } - - /// - /// 4 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(4); - } - } - + public static class Four + { + /// + /// 4 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(4); } + } + + /// + /// 4 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(4); + } + + /// + /// 4 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(4); } + } + + /// + /// 4 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(4); + } + + /// + /// 4 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(4); } + } + + /// + /// 4 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(4); + } + + /// + /// 4 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(4); } + } + + /// + /// 4 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(4); + } + + /// + /// 4 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(28); } + } + + /// + /// 4 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(28); + } + + /// + /// 4 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(4); } + } + + /// + /// 4 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(4); + } + + /// + /// 4 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(4); } + } + + /// + /// 4 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(4); + } + } + /// /// - public static class Five - { - /// - /// 5 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(5); } - } - - /// - /// 5 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(5); - } - - /// - /// 5 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(5); } - } - - /// - /// 5 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(5); - } - - /// - /// 5 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(5); } - } - - /// - /// 5 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(5); - } - - /// - /// 5 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(5); } - } - - /// - /// 5 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(5); - } - - /// - /// 5 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(35); } - } - - /// - /// 5 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(35); - } - - /// - /// 5 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(5); } - } - - /// - /// 5 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(5); - } - - /// - /// 5 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(5); } - } - - /// - /// 5 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(5); - } - } - + public static class Five + { + /// + /// 5 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(5); } + } + + /// + /// 5 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(5); + } + + /// + /// 5 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(5); } + } + + /// + /// 5 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(5); + } + + /// + /// 5 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(5); } + } + + /// + /// 5 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(5); + } + + /// + /// 5 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(5); } + } + + /// + /// 5 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(5); + } + + /// + /// 5 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(35); } + } + + /// + /// 5 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(35); + } + + /// + /// 5 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(5); } + } + + /// + /// 5 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(5); + } + + /// + /// 5 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(5); } + } + + /// + /// 5 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(5); + } + } + /// /// - public static class Six - { - /// - /// 6 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(6); } - } - - /// - /// 6 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(6); - } - - /// - /// 6 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(6); } - } - - /// - /// 6 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(6); - } - - /// - /// 6 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(6); } - } - - /// - /// 6 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(6); - } - - /// - /// 6 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(6); } - } - - /// - /// 6 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(6); - } - - /// - /// 6 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(42); } - } - - /// - /// 6 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(42); - } - - /// - /// 6 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(6); } - } - - /// - /// 6 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(6); - } - - /// - /// 6 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(6); } - } - - /// - /// 6 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(6); - } - } - + public static class Six + { + /// + /// 6 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(6); } + } + + /// + /// 6 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(6); + } + + /// + /// 6 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(6); } + } + + /// + /// 6 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(6); + } + + /// + /// 6 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(6); } + } + + /// + /// 6 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(6); + } + + /// + /// 6 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(6); } + } + + /// + /// 6 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(6); + } + + /// + /// 6 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(42); } + } + + /// + /// 6 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(42); + } + + /// + /// 6 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(6); } + } + + /// + /// 6 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(6); + } + + /// + /// 6 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(6); } + } + + /// + /// 6 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(6); + } + } + /// /// - public static class Seven - { - /// - /// 7 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(7); } - } - - /// - /// 7 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(7); - } - - /// - /// 7 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(7); } - } - - /// - /// 7 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(7); - } - - /// - /// 7 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(7); } - } - - /// - /// 7 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(7); - } - - /// - /// 7 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(7); } - } - - /// - /// 7 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(7); - } - - /// - /// 7 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(49); } - } - - /// - /// 7 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(49); - } - - /// - /// 7 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(7); } - } - - /// - /// 7 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(7); - } - - /// - /// 7 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(7); } - } - - /// - /// 7 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(7); - } - } - + public static class Seven + { + /// + /// 7 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(7); } + } + + /// + /// 7 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(7); + } + + /// + /// 7 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(7); } + } + + /// + /// 7 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(7); + } + + /// + /// 7 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(7); } + } + + /// + /// 7 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(7); + } + + /// + /// 7 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(7); } + } + + /// + /// 7 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(7); + } + + /// + /// 7 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(49); } + } + + /// + /// 7 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(49); + } + + /// + /// 7 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(7); } + } + + /// + /// 7 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(7); + } + + /// + /// 7 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(7); } + } + + /// + /// 7 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(7); + } + } + /// /// - public static class Eight - { - /// - /// 8 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(8); } - } - - /// - /// 8 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(8); - } - - /// - /// 8 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(8); } - } - - /// - /// 8 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(8); - } - - /// - /// 8 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(8); } - } - - /// - /// 8 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(8); - } - - /// - /// 8 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(8); } - } - - /// - /// 8 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(8); - } - - /// - /// 8 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(56); } - } - - /// - /// 8 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(56); - } - - /// - /// 8 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(8); } - } - - /// - /// 8 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(8); - } - - /// - /// 8 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(8); } - } - - /// - /// 8 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(8); - } - } - + public static class Eight + { + /// + /// 8 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(8); } + } + + /// + /// 8 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(8); + } + + /// + /// 8 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(8); } + } + + /// + /// 8 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(8); + } + + /// + /// 8 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(8); } + } + + /// + /// 8 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(8); + } + + /// + /// 8 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(8); } + } + + /// + /// 8 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(8); + } + + /// + /// 8 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(56); } + } + + /// + /// 8 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(56); + } + + /// + /// 8 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(8); } + } + + /// + /// 8 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(8); + } + + /// + /// 8 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(8); } + } + + /// + /// 8 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(8); + } + } + /// /// - public static class Nine - { - /// - /// 9 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(9); } - } - - /// - /// 9 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(9); - } - - /// - /// 9 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(9); } - } - - /// - /// 9 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(9); - } - - /// - /// 9 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(9); } - } - - /// - /// 9 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(9); - } - - /// - /// 9 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(9); } - } - - /// - /// 9 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(9); - } - - /// - /// 9 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(63); } - } - - /// - /// 9 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(63); - } - - /// - /// 9 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(9); } - } - - /// - /// 9 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(9); - } - - /// - /// 9 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(9); } - } - - /// - /// 9 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(9); - } - } - + public static class Nine + { + /// + /// 9 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(9); } + } + + /// + /// 9 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(9); + } + + /// + /// 9 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(9); } + } + + /// + /// 9 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(9); + } + + /// + /// 9 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(9); } + } + + /// + /// 9 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(9); + } + + /// + /// 9 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(9); } + } + + /// + /// 9 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(9); + } + + /// + /// 9 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(63); } + } + + /// + /// 9 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(63); + } + + /// + /// 9 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(9); } + } + + /// + /// 9 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(9); + } + + /// + /// 9 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(9); } + } + + /// + /// 9 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(9); + } + } + /// /// - public static class Ten - { - /// - /// 10 seconds from now - /// - public static DateTime Seconds - { - get { return DateTime.UtcNow.AddSeconds(10); } - } - - /// - /// 10 seconds from the provided date - /// - public static DateTime SecondsFrom(DateTime date) - { - return date.AddSeconds(10); - } - - /// - /// 10 minutes from now - /// - public static DateTime Minutes - { - get { return DateTime.UtcNow.AddMinutes(10); } - } - - /// - /// 10 minutes from the provided date - /// - public static DateTime MinutesFrom(DateTime date) - { - return date.AddMinutes(10); - } - - /// - /// 10 hours from now - /// - public static DateTime Hours - { - get { return DateTime.UtcNow.AddHours(10); } - } - - /// - /// 10 hours from the provided date - /// - public static DateTime HoursFrom(DateTime date) - { - return date.AddHours(10); - } - - /// - /// 10 days from now - /// - public static DateTime Days - { - get { return DateTime.UtcNow.AddDays(10); } - } - - /// - /// 10 days from the provided date - /// - public static DateTime DaysFrom(DateTime date) - { - return date.AddDays(10); - } - - /// - /// 10 weeks from now - /// - public static DateTime Weeks - { - get { return DateTime.UtcNow.AddDays(70); } - } - - /// - /// 10 weeks from the provided date - /// - public static DateTime WeeksFrom(DateTime date) - { - return date.AddDays(70); - } - - /// - /// 10 months from now - /// - public static DateTime Months - { - get { return DateTime.UtcNow.AddMonths(10); } - } - - /// - /// 10 months from the provided date - /// - public static DateTime MonthsFrom(DateTime date) - { - return date.AddMonths(10); - } - - /// - /// 10 years from now - /// - public static DateTime Years - { - get { return DateTime.UtcNow.AddYears(10); } - } - - /// - /// 10 years from the provided date - /// - public static DateTime YearsFrom(DateTime date) - { - return date.AddYears(10); - } - } - } + public static class Ten + { + /// + /// 10 seconds from now + /// + public static DateTime Seconds + { + get { return DateTime.UtcNow.AddSeconds(10); } + } + + /// + /// 10 seconds from the provided date + /// + public static DateTime SecondsFrom(DateTime date) + { + return date.AddSeconds(10); + } + + /// + /// 10 minutes from now + /// + public static DateTime Minutes + { + get { return DateTime.UtcNow.AddMinutes(10); } + } + + /// + /// 10 minutes from the provided date + /// + public static DateTime MinutesFrom(DateTime date) + { + return date.AddMinutes(10); + } + + /// + /// 10 hours from now + /// + public static DateTime Hours + { + get { return DateTime.UtcNow.AddHours(10); } + } + + /// + /// 10 hours from the provided date + /// + public static DateTime HoursFrom(DateTime date) + { + return date.AddHours(10); + } + + /// + /// 10 days from now + /// + public static DateTime Days + { + get { return DateTime.UtcNow.AddDays(10); } + } + + /// + /// 10 days from the provided date + /// + public static DateTime DaysFrom(DateTime date) + { + return date.AddDays(10); + } + + /// + /// 10 weeks from now + /// + public static DateTime Weeks + { + get { return DateTime.UtcNow.AddDays(70); } + } + + /// + /// 10 weeks from the provided date + /// + public static DateTime WeeksFrom(DateTime date) + { + return date.AddDays(70); + } + + /// + /// 10 months from now + /// + public static DateTime Months + { + get { return DateTime.UtcNow.AddMonths(10); } + } + + /// + /// 10 months from the provided date + /// + public static DateTime MonthsFrom(DateTime date) + { + return date.AddMonths(10); + } + + /// + /// 10 years from now + /// + public static DateTime Years + { + get { return DateTime.UtcNow.AddYears(10); } + } + + /// + /// 10 years from the provided date + /// + public static DateTime YearsFrom(DateTime date) + { + return date.AddYears(10); + } + } + } } \ No newline at end of file diff --git a/src/Humanizer/FluentDate/On.Days.cs b/src/Humanizer/FluentDate/On.Days.cs index fc784d6c0..f67dbcf5f 100644 --- a/src/Humanizer/FluentDate/On.Days.cs +++ b/src/Humanizer/FluentDate/On.Days.cs @@ -1,4 +1,4 @@ - + using System; namespace Humanizer @@ -7,3101 +7,3101 @@ namespace Humanizer /// public partial class On { - + /// - /// Provides fluent date accessors for January + /// Provides fluent date accessors for January /// - public class January - { - /// - /// The nth day of January of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 1, dayNumber); - } - - /// - /// The 1st day of January of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 1, 1); } - } - - /// - /// The 2nd day of January of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 1, 2); } - } - - /// - /// The 3rd day of January of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 1, 3); } - } - - /// - /// The 4th day of January of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 1, 4); } - } - - /// - /// The 5th day of January of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 1, 5); } - } - - /// - /// The 6th day of January of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 1, 6); } - } - - /// - /// The 7th day of January of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 1, 7); } - } - - /// - /// The 8th day of January of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 1, 8); } - } - - /// - /// The 9th day of January of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 1, 9); } - } - - /// - /// The 10th day of January of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 1, 10); } - } - - /// - /// The 11th day of January of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 1, 11); } - } - - /// - /// The 12th day of January of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 1, 12); } - } - - /// - /// The 13th day of January of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 1, 13); } - } - - /// - /// The 14th day of January of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 1, 14); } - } - - /// - /// The 15th day of January of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 1, 15); } - } - - /// - /// The 16th day of January of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 1, 16); } - } - - /// - /// The 17th day of January of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 1, 17); } - } - - /// - /// The 18th day of January of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 1, 18); } - } - - /// - /// The 19th day of January of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 1, 19); } - } - - /// - /// The 20th day of January of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 1, 20); } - } - - /// - /// The 21st day of January of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 1, 21); } - } - - /// - /// The 22nd day of January of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 1, 22); } - } - - /// - /// The 23rd day of January of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 1, 23); } - } - - /// - /// The 24th day of January of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 1, 24); } - } - - /// - /// The 25th day of January of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 1, 25); } - } - - /// - /// The 26th day of January of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 1, 26); } - } - - /// - /// The 27th day of January of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 1, 27); } - } - - /// - /// The 28th day of January of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 1, 28); } - } - - /// - /// The 29th day of January of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 1, 29); } - } - - /// - /// The 30th day of January of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 1, 30); } - } - - /// - /// The 31st day of January of the current year - /// - public static DateTime The31st - { - get { return new DateTime(DateTime.Now.Year, 1, 31); } - } - } - + public class January + { + /// + /// The nth day of January of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 1, dayNumber); + } + + /// + /// The 1st day of January of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 1, 1); } + } + + /// + /// The 2nd day of January of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 1, 2); } + } + + /// + /// The 3rd day of January of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 1, 3); } + } + + /// + /// The 4th day of January of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 1, 4); } + } + + /// + /// The 5th day of January of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 1, 5); } + } + + /// + /// The 6th day of January of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 1, 6); } + } + + /// + /// The 7th day of January of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 1, 7); } + } + + /// + /// The 8th day of January of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 1, 8); } + } + + /// + /// The 9th day of January of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 1, 9); } + } + + /// + /// The 10th day of January of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 1, 10); } + } + + /// + /// The 11th day of January of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 1, 11); } + } + + /// + /// The 12th day of January of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 1, 12); } + } + + /// + /// The 13th day of January of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 1, 13); } + } + + /// + /// The 14th day of January of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 1, 14); } + } + + /// + /// The 15th day of January of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 1, 15); } + } + + /// + /// The 16th day of January of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 1, 16); } + } + + /// + /// The 17th day of January of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 1, 17); } + } + + /// + /// The 18th day of January of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 1, 18); } + } + + /// + /// The 19th day of January of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 1, 19); } + } + + /// + /// The 20th day of January of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 1, 20); } + } + + /// + /// The 21st day of January of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 1, 21); } + } + + /// + /// The 22nd day of January of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 1, 22); } + } + + /// + /// The 23rd day of January of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 1, 23); } + } + + /// + /// The 24th day of January of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 1, 24); } + } + + /// + /// The 25th day of January of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 1, 25); } + } + + /// + /// The 26th day of January of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 1, 26); } + } + + /// + /// The 27th day of January of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 1, 27); } + } + + /// + /// The 28th day of January of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 1, 28); } + } + + /// + /// The 29th day of January of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 1, 29); } + } + + /// + /// The 30th day of January of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 1, 30); } + } + + /// + /// The 31st day of January of the current year + /// + public static DateTime The31st + { + get { return new DateTime(DateTime.Now.Year, 1, 31); } + } + } + /// - /// Provides fluent date accessors for February + /// Provides fluent date accessors for February /// - public class February - { - /// - /// The nth day of February of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 2, dayNumber); - } - - /// - /// The 1st day of February of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 2, 1); } - } - - /// - /// The 2nd day of February of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 2, 2); } - } - - /// - /// The 3rd day of February of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 2, 3); } - } - - /// - /// The 4th day of February of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 2, 4); } - } - - /// - /// The 5th day of February of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 2, 5); } - } - - /// - /// The 6th day of February of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 2, 6); } - } - - /// - /// The 7th day of February of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 2, 7); } - } - - /// - /// The 8th day of February of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 2, 8); } - } - - /// - /// The 9th day of February of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 2, 9); } - } - - /// - /// The 10th day of February of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 2, 10); } - } - - /// - /// The 11th day of February of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 2, 11); } - } - - /// - /// The 12th day of February of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 2, 12); } - } - - /// - /// The 13th day of February of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 2, 13); } - } - - /// - /// The 14th day of February of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 2, 14); } - } - - /// - /// The 15th day of February of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 2, 15); } - } - - /// - /// The 16th day of February of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 2, 16); } - } - - /// - /// The 17th day of February of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 2, 17); } - } - - /// - /// The 18th day of February of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 2, 18); } - } - - /// - /// The 19th day of February of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 2, 19); } - } - - /// - /// The 20th day of February of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 2, 20); } - } - - /// - /// The 21st day of February of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 2, 21); } - } - - /// - /// The 22nd day of February of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 2, 22); } - } - - /// - /// The 23rd day of February of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 2, 23); } - } - - /// - /// The 24th day of February of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 2, 24); } - } - - /// - /// The 25th day of February of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 2, 25); } - } - - /// - /// The 26th day of February of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 2, 26); } - } - - /// - /// The 27th day of February of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 2, 27); } - } - - /// - /// The 28th day of February of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 2, 28); } - } - - /// - /// The 29th day of February of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 2, 29); } - } - } - + public class February + { + /// + /// The nth day of February of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 2, dayNumber); + } + + /// + /// The 1st day of February of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 2, 1); } + } + + /// + /// The 2nd day of February of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 2, 2); } + } + + /// + /// The 3rd day of February of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 2, 3); } + } + + /// + /// The 4th day of February of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 2, 4); } + } + + /// + /// The 5th day of February of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 2, 5); } + } + + /// + /// The 6th day of February of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 2, 6); } + } + + /// + /// The 7th day of February of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 2, 7); } + } + + /// + /// The 8th day of February of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 2, 8); } + } + + /// + /// The 9th day of February of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 2, 9); } + } + + /// + /// The 10th day of February of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 2, 10); } + } + + /// + /// The 11th day of February of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 2, 11); } + } + + /// + /// The 12th day of February of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 2, 12); } + } + + /// + /// The 13th day of February of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 2, 13); } + } + + /// + /// The 14th day of February of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 2, 14); } + } + + /// + /// The 15th day of February of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 2, 15); } + } + + /// + /// The 16th day of February of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 2, 16); } + } + + /// + /// The 17th day of February of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 2, 17); } + } + + /// + /// The 18th day of February of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 2, 18); } + } + + /// + /// The 19th day of February of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 2, 19); } + } + + /// + /// The 20th day of February of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 2, 20); } + } + + /// + /// The 21st day of February of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 2, 21); } + } + + /// + /// The 22nd day of February of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 2, 22); } + } + + /// + /// The 23rd day of February of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 2, 23); } + } + + /// + /// The 24th day of February of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 2, 24); } + } + + /// + /// The 25th day of February of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 2, 25); } + } + + /// + /// The 26th day of February of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 2, 26); } + } + + /// + /// The 27th day of February of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 2, 27); } + } + + /// + /// The 28th day of February of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 2, 28); } + } + + /// + /// The 29th day of February of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 2, 29); } + } + } + /// - /// Provides fluent date accessors for March + /// Provides fluent date accessors for March /// - public class March - { - /// - /// The nth day of March of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 3, dayNumber); - } - - /// - /// The 1st day of March of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 3, 1); } - } - - /// - /// The 2nd day of March of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 3, 2); } - } - - /// - /// The 3rd day of March of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 3, 3); } - } - - /// - /// The 4th day of March of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 3, 4); } - } - - /// - /// The 5th day of March of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 3, 5); } - } - - /// - /// The 6th day of March of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 3, 6); } - } - - /// - /// The 7th day of March of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 3, 7); } - } - - /// - /// The 8th day of March of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 3, 8); } - } - - /// - /// The 9th day of March of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 3, 9); } - } - - /// - /// The 10th day of March of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 3, 10); } - } - - /// - /// The 11th day of March of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 3, 11); } - } - - /// - /// The 12th day of March of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 3, 12); } - } - - /// - /// The 13th day of March of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 3, 13); } - } - - /// - /// The 14th day of March of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 3, 14); } - } - - /// - /// The 15th day of March of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 3, 15); } - } - - /// - /// The 16th day of March of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 3, 16); } - } - - /// - /// The 17th day of March of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 3, 17); } - } - - /// - /// The 18th day of March of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 3, 18); } - } - - /// - /// The 19th day of March of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 3, 19); } - } - - /// - /// The 20th day of March of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 3, 20); } - } - - /// - /// The 21st day of March of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 3, 21); } - } - - /// - /// The 22nd day of March of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 3, 22); } - } - - /// - /// The 23rd day of March of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 3, 23); } - } - - /// - /// The 24th day of March of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 3, 24); } - } - - /// - /// The 25th day of March of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 3, 25); } - } - - /// - /// The 26th day of March of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 3, 26); } - } - - /// - /// The 27th day of March of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 3, 27); } - } - - /// - /// The 28th day of March of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 3, 28); } - } - - /// - /// The 29th day of March of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 3, 29); } - } - - /// - /// The 30th day of March of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 3, 30); } - } - - /// - /// The 31st day of March of the current year - /// - public static DateTime The31st - { - get { return new DateTime(DateTime.Now.Year, 3, 31); } - } - } - + public class March + { + /// + /// The nth day of March of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 3, dayNumber); + } + + /// + /// The 1st day of March of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 3, 1); } + } + + /// + /// The 2nd day of March of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 3, 2); } + } + + /// + /// The 3rd day of March of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 3, 3); } + } + + /// + /// The 4th day of March of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 3, 4); } + } + + /// + /// The 5th day of March of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 3, 5); } + } + + /// + /// The 6th day of March of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 3, 6); } + } + + /// + /// The 7th day of March of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 3, 7); } + } + + /// + /// The 8th day of March of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 3, 8); } + } + + /// + /// The 9th day of March of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 3, 9); } + } + + /// + /// The 10th day of March of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 3, 10); } + } + + /// + /// The 11th day of March of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 3, 11); } + } + + /// + /// The 12th day of March of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 3, 12); } + } + + /// + /// The 13th day of March of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 3, 13); } + } + + /// + /// The 14th day of March of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 3, 14); } + } + + /// + /// The 15th day of March of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 3, 15); } + } + + /// + /// The 16th day of March of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 3, 16); } + } + + /// + /// The 17th day of March of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 3, 17); } + } + + /// + /// The 18th day of March of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 3, 18); } + } + + /// + /// The 19th day of March of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 3, 19); } + } + + /// + /// The 20th day of March of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 3, 20); } + } + + /// + /// The 21st day of March of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 3, 21); } + } + + /// + /// The 22nd day of March of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 3, 22); } + } + + /// + /// The 23rd day of March of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 3, 23); } + } + + /// + /// The 24th day of March of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 3, 24); } + } + + /// + /// The 25th day of March of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 3, 25); } + } + + /// + /// The 26th day of March of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 3, 26); } + } + + /// + /// The 27th day of March of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 3, 27); } + } + + /// + /// The 28th day of March of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 3, 28); } + } + + /// + /// The 29th day of March of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 3, 29); } + } + + /// + /// The 30th day of March of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 3, 30); } + } + + /// + /// The 31st day of March of the current year + /// + public static DateTime The31st + { + get { return new DateTime(DateTime.Now.Year, 3, 31); } + } + } + /// - /// Provides fluent date accessors for April + /// Provides fluent date accessors for April /// - public class April - { - /// - /// The nth day of April of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 4, dayNumber); - } - - /// - /// The 1st day of April of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 4, 1); } - } - - /// - /// The 2nd day of April of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 4, 2); } - } - - /// - /// The 3rd day of April of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 4, 3); } - } - - /// - /// The 4th day of April of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 4, 4); } - } - - /// - /// The 5th day of April of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 4, 5); } - } - - /// - /// The 6th day of April of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 4, 6); } - } - - /// - /// The 7th day of April of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 4, 7); } - } - - /// - /// The 8th day of April of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 4, 8); } - } - - /// - /// The 9th day of April of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 4, 9); } - } - - /// - /// The 10th day of April of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 4, 10); } - } - - /// - /// The 11th day of April of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 4, 11); } - } - - /// - /// The 12th day of April of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 4, 12); } - } - - /// - /// The 13th day of April of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 4, 13); } - } - - /// - /// The 14th day of April of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 4, 14); } - } - - /// - /// The 15th day of April of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 4, 15); } - } - - /// - /// The 16th day of April of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 4, 16); } - } - - /// - /// The 17th day of April of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 4, 17); } - } - - /// - /// The 18th day of April of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 4, 18); } - } - - /// - /// The 19th day of April of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 4, 19); } - } - - /// - /// The 20th day of April of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 4, 20); } - } - - /// - /// The 21st day of April of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 4, 21); } - } - - /// - /// The 22nd day of April of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 4, 22); } - } - - /// - /// The 23rd day of April of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 4, 23); } - } - - /// - /// The 24th day of April of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 4, 24); } - } - - /// - /// The 25th day of April of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 4, 25); } - } - - /// - /// The 26th day of April of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 4, 26); } - } - - /// - /// The 27th day of April of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 4, 27); } - } - - /// - /// The 28th day of April of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 4, 28); } - } - - /// - /// The 29th day of April of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 4, 29); } - } - - /// - /// The 30th day of April of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 4, 30); } - } - } - + public class April + { + /// + /// The nth day of April of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 4, dayNumber); + } + + /// + /// The 1st day of April of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 4, 1); } + } + + /// + /// The 2nd day of April of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 4, 2); } + } + + /// + /// The 3rd day of April of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 4, 3); } + } + + /// + /// The 4th day of April of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 4, 4); } + } + + /// + /// The 5th day of April of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 4, 5); } + } + + /// + /// The 6th day of April of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 4, 6); } + } + + /// + /// The 7th day of April of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 4, 7); } + } + + /// + /// The 8th day of April of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 4, 8); } + } + + /// + /// The 9th day of April of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 4, 9); } + } + + /// + /// The 10th day of April of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 4, 10); } + } + + /// + /// The 11th day of April of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 4, 11); } + } + + /// + /// The 12th day of April of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 4, 12); } + } + + /// + /// The 13th day of April of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 4, 13); } + } + + /// + /// The 14th day of April of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 4, 14); } + } + + /// + /// The 15th day of April of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 4, 15); } + } + + /// + /// The 16th day of April of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 4, 16); } + } + + /// + /// The 17th day of April of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 4, 17); } + } + + /// + /// The 18th day of April of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 4, 18); } + } + + /// + /// The 19th day of April of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 4, 19); } + } + + /// + /// The 20th day of April of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 4, 20); } + } + + /// + /// The 21st day of April of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 4, 21); } + } + + /// + /// The 22nd day of April of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 4, 22); } + } + + /// + /// The 23rd day of April of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 4, 23); } + } + + /// + /// The 24th day of April of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 4, 24); } + } + + /// + /// The 25th day of April of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 4, 25); } + } + + /// + /// The 26th day of April of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 4, 26); } + } + + /// + /// The 27th day of April of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 4, 27); } + } + + /// + /// The 28th day of April of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 4, 28); } + } + + /// + /// The 29th day of April of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 4, 29); } + } + + /// + /// The 30th day of April of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 4, 30); } + } + } + /// - /// Provides fluent date accessors for May + /// Provides fluent date accessors for May /// - public class May - { - /// - /// The nth day of May of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 5, dayNumber); - } - - /// - /// The 1st day of May of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 5, 1); } - } - - /// - /// The 2nd day of May of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 5, 2); } - } - - /// - /// The 3rd day of May of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 5, 3); } - } - - /// - /// The 4th day of May of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 5, 4); } - } - - /// - /// The 5th day of May of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 5, 5); } - } - - /// - /// The 6th day of May of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 5, 6); } - } - - /// - /// The 7th day of May of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 5, 7); } - } - - /// - /// The 8th day of May of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 5, 8); } - } - - /// - /// The 9th day of May of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 5, 9); } - } - - /// - /// The 10th day of May of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 5, 10); } - } - - /// - /// The 11th day of May of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 5, 11); } - } - - /// - /// The 12th day of May of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 5, 12); } - } - - /// - /// The 13th day of May of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 5, 13); } - } - - /// - /// The 14th day of May of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 5, 14); } - } - - /// - /// The 15th day of May of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 5, 15); } - } - - /// - /// The 16th day of May of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 5, 16); } - } - - /// - /// The 17th day of May of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 5, 17); } - } - - /// - /// The 18th day of May of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 5, 18); } - } - - /// - /// The 19th day of May of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 5, 19); } - } - - /// - /// The 20th day of May of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 5, 20); } - } - - /// - /// The 21st day of May of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 5, 21); } - } - - /// - /// The 22nd day of May of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 5, 22); } - } - - /// - /// The 23rd day of May of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 5, 23); } - } - - /// - /// The 24th day of May of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 5, 24); } - } - - /// - /// The 25th day of May of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 5, 25); } - } - - /// - /// The 26th day of May of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 5, 26); } - } - - /// - /// The 27th day of May of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 5, 27); } - } - - /// - /// The 28th day of May of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 5, 28); } - } - - /// - /// The 29th day of May of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 5, 29); } - } - - /// - /// The 30th day of May of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 5, 30); } - } - - /// - /// The 31st day of May of the current year - /// - public static DateTime The31st - { - get { return new DateTime(DateTime.Now.Year, 5, 31); } - } - } - + public class May + { + /// + /// The nth day of May of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 5, dayNumber); + } + + /// + /// The 1st day of May of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 5, 1); } + } + + /// + /// The 2nd day of May of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 5, 2); } + } + + /// + /// The 3rd day of May of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 5, 3); } + } + + /// + /// The 4th day of May of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 5, 4); } + } + + /// + /// The 5th day of May of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 5, 5); } + } + + /// + /// The 6th day of May of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 5, 6); } + } + + /// + /// The 7th day of May of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 5, 7); } + } + + /// + /// The 8th day of May of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 5, 8); } + } + + /// + /// The 9th day of May of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 5, 9); } + } + + /// + /// The 10th day of May of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 5, 10); } + } + + /// + /// The 11th day of May of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 5, 11); } + } + + /// + /// The 12th day of May of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 5, 12); } + } + + /// + /// The 13th day of May of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 5, 13); } + } + + /// + /// The 14th day of May of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 5, 14); } + } + + /// + /// The 15th day of May of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 5, 15); } + } + + /// + /// The 16th day of May of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 5, 16); } + } + + /// + /// The 17th day of May of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 5, 17); } + } + + /// + /// The 18th day of May of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 5, 18); } + } + + /// + /// The 19th day of May of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 5, 19); } + } + + /// + /// The 20th day of May of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 5, 20); } + } + + /// + /// The 21st day of May of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 5, 21); } + } + + /// + /// The 22nd day of May of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 5, 22); } + } + + /// + /// The 23rd day of May of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 5, 23); } + } + + /// + /// The 24th day of May of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 5, 24); } + } + + /// + /// The 25th day of May of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 5, 25); } + } + + /// + /// The 26th day of May of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 5, 26); } + } + + /// + /// The 27th day of May of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 5, 27); } + } + + /// + /// The 28th day of May of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 5, 28); } + } + + /// + /// The 29th day of May of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 5, 29); } + } + + /// + /// The 30th day of May of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 5, 30); } + } + + /// + /// The 31st day of May of the current year + /// + public static DateTime The31st + { + get { return new DateTime(DateTime.Now.Year, 5, 31); } + } + } + /// - /// Provides fluent date accessors for June + /// Provides fluent date accessors for June /// - public class June - { - /// - /// The nth day of June of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 6, dayNumber); - } - - /// - /// The 1st day of June of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 6, 1); } - } - - /// - /// The 2nd day of June of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 6, 2); } - } - - /// - /// The 3rd day of June of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 6, 3); } - } - - /// - /// The 4th day of June of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 6, 4); } - } - - /// - /// The 5th day of June of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 6, 5); } - } - - /// - /// The 6th day of June of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 6, 6); } - } - - /// - /// The 7th day of June of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 6, 7); } - } - - /// - /// The 8th day of June of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 6, 8); } - } - - /// - /// The 9th day of June of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 6, 9); } - } - - /// - /// The 10th day of June of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 6, 10); } - } - - /// - /// The 11th day of June of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 6, 11); } - } - - /// - /// The 12th day of June of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 6, 12); } - } - - /// - /// The 13th day of June of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 6, 13); } - } - - /// - /// The 14th day of June of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 6, 14); } - } - - /// - /// The 15th day of June of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 6, 15); } - } - - /// - /// The 16th day of June of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 6, 16); } - } - - /// - /// The 17th day of June of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 6, 17); } - } - - /// - /// The 18th day of June of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 6, 18); } - } - - /// - /// The 19th day of June of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 6, 19); } - } - - /// - /// The 20th day of June of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 6, 20); } - } - - /// - /// The 21st day of June of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 6, 21); } - } - - /// - /// The 22nd day of June of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 6, 22); } - } - - /// - /// The 23rd day of June of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 6, 23); } - } - - /// - /// The 24th day of June of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 6, 24); } - } - - /// - /// The 25th day of June of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 6, 25); } - } - - /// - /// The 26th day of June of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 6, 26); } - } - - /// - /// The 27th day of June of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 6, 27); } - } - - /// - /// The 28th day of June of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 6, 28); } - } - - /// - /// The 29th day of June of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 6, 29); } - } - - /// - /// The 30th day of June of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 6, 30); } - } - } - + public class June + { + /// + /// The nth day of June of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 6, dayNumber); + } + + /// + /// The 1st day of June of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 6, 1); } + } + + /// + /// The 2nd day of June of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 6, 2); } + } + + /// + /// The 3rd day of June of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 6, 3); } + } + + /// + /// The 4th day of June of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 6, 4); } + } + + /// + /// The 5th day of June of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 6, 5); } + } + + /// + /// The 6th day of June of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 6, 6); } + } + + /// + /// The 7th day of June of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 6, 7); } + } + + /// + /// The 8th day of June of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 6, 8); } + } + + /// + /// The 9th day of June of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 6, 9); } + } + + /// + /// The 10th day of June of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 6, 10); } + } + + /// + /// The 11th day of June of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 6, 11); } + } + + /// + /// The 12th day of June of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 6, 12); } + } + + /// + /// The 13th day of June of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 6, 13); } + } + + /// + /// The 14th day of June of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 6, 14); } + } + + /// + /// The 15th day of June of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 6, 15); } + } + + /// + /// The 16th day of June of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 6, 16); } + } + + /// + /// The 17th day of June of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 6, 17); } + } + + /// + /// The 18th day of June of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 6, 18); } + } + + /// + /// The 19th day of June of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 6, 19); } + } + + /// + /// The 20th day of June of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 6, 20); } + } + + /// + /// The 21st day of June of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 6, 21); } + } + + /// + /// The 22nd day of June of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 6, 22); } + } + + /// + /// The 23rd day of June of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 6, 23); } + } + + /// + /// The 24th day of June of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 6, 24); } + } + + /// + /// The 25th day of June of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 6, 25); } + } + + /// + /// The 26th day of June of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 6, 26); } + } + + /// + /// The 27th day of June of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 6, 27); } + } + + /// + /// The 28th day of June of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 6, 28); } + } + + /// + /// The 29th day of June of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 6, 29); } + } + + /// + /// The 30th day of June of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 6, 30); } + } + } + /// - /// Provides fluent date accessors for July + /// Provides fluent date accessors for July /// - public class July - { - /// - /// The nth day of July of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 7, dayNumber); - } - - /// - /// The 1st day of July of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 7, 1); } - } - - /// - /// The 2nd day of July of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 7, 2); } - } - - /// - /// The 3rd day of July of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 7, 3); } - } - - /// - /// The 4th day of July of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 7, 4); } - } - - /// - /// The 5th day of July of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 7, 5); } - } - - /// - /// The 6th day of July of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 7, 6); } - } - - /// - /// The 7th day of July of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 7, 7); } - } - - /// - /// The 8th day of July of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 7, 8); } - } - - /// - /// The 9th day of July of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 7, 9); } - } - - /// - /// The 10th day of July of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 7, 10); } - } - - /// - /// The 11th day of July of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 7, 11); } - } - - /// - /// The 12th day of July of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 7, 12); } - } - - /// - /// The 13th day of July of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 7, 13); } - } - - /// - /// The 14th day of July of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 7, 14); } - } - - /// - /// The 15th day of July of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 7, 15); } - } - - /// - /// The 16th day of July of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 7, 16); } - } - - /// - /// The 17th day of July of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 7, 17); } - } - - /// - /// The 18th day of July of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 7, 18); } - } - - /// - /// The 19th day of July of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 7, 19); } - } - - /// - /// The 20th day of July of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 7, 20); } - } - - /// - /// The 21st day of July of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 7, 21); } - } - - /// - /// The 22nd day of July of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 7, 22); } - } - - /// - /// The 23rd day of July of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 7, 23); } - } - - /// - /// The 24th day of July of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 7, 24); } - } - - /// - /// The 25th day of July of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 7, 25); } - } - - /// - /// The 26th day of July of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 7, 26); } - } - - /// - /// The 27th day of July of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 7, 27); } - } - - /// - /// The 28th day of July of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 7, 28); } - } - - /// - /// The 29th day of July of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 7, 29); } - } - - /// - /// The 30th day of July of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 7, 30); } - } - - /// - /// The 31st day of July of the current year - /// - public static DateTime The31st - { - get { return new DateTime(DateTime.Now.Year, 7, 31); } - } - } - + public class July + { + /// + /// The nth day of July of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 7, dayNumber); + } + + /// + /// The 1st day of July of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 7, 1); } + } + + /// + /// The 2nd day of July of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 7, 2); } + } + + /// + /// The 3rd day of July of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 7, 3); } + } + + /// + /// The 4th day of July of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 7, 4); } + } + + /// + /// The 5th day of July of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 7, 5); } + } + + /// + /// The 6th day of July of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 7, 6); } + } + + /// + /// The 7th day of July of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 7, 7); } + } + + /// + /// The 8th day of July of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 7, 8); } + } + + /// + /// The 9th day of July of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 7, 9); } + } + + /// + /// The 10th day of July of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 7, 10); } + } + + /// + /// The 11th day of July of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 7, 11); } + } + + /// + /// The 12th day of July of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 7, 12); } + } + + /// + /// The 13th day of July of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 7, 13); } + } + + /// + /// The 14th day of July of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 7, 14); } + } + + /// + /// The 15th day of July of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 7, 15); } + } + + /// + /// The 16th day of July of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 7, 16); } + } + + /// + /// The 17th day of July of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 7, 17); } + } + + /// + /// The 18th day of July of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 7, 18); } + } + + /// + /// The 19th day of July of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 7, 19); } + } + + /// + /// The 20th day of July of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 7, 20); } + } + + /// + /// The 21st day of July of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 7, 21); } + } + + /// + /// The 22nd day of July of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 7, 22); } + } + + /// + /// The 23rd day of July of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 7, 23); } + } + + /// + /// The 24th day of July of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 7, 24); } + } + + /// + /// The 25th day of July of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 7, 25); } + } + + /// + /// The 26th day of July of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 7, 26); } + } + + /// + /// The 27th day of July of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 7, 27); } + } + + /// + /// The 28th day of July of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 7, 28); } + } + + /// + /// The 29th day of July of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 7, 29); } + } + + /// + /// The 30th day of July of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 7, 30); } + } + + /// + /// The 31st day of July of the current year + /// + public static DateTime The31st + { + get { return new DateTime(DateTime.Now.Year, 7, 31); } + } + } + /// - /// Provides fluent date accessors for August + /// Provides fluent date accessors for August /// - public class August - { - /// - /// The nth day of August of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 8, dayNumber); - } - - /// - /// The 1st day of August of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 8, 1); } - } - - /// - /// The 2nd day of August of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 8, 2); } - } - - /// - /// The 3rd day of August of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 8, 3); } - } - - /// - /// The 4th day of August of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 8, 4); } - } - - /// - /// The 5th day of August of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 8, 5); } - } - - /// - /// The 6th day of August of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 8, 6); } - } - - /// - /// The 7th day of August of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 8, 7); } - } - - /// - /// The 8th day of August of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 8, 8); } - } - - /// - /// The 9th day of August of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 8, 9); } - } - - /// - /// The 10th day of August of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 8, 10); } - } - - /// - /// The 11th day of August of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 8, 11); } - } - - /// - /// The 12th day of August of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 8, 12); } - } - - /// - /// The 13th day of August of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 8, 13); } - } - - /// - /// The 14th day of August of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 8, 14); } - } - - /// - /// The 15th day of August of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 8, 15); } - } - - /// - /// The 16th day of August of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 8, 16); } - } - - /// - /// The 17th day of August of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 8, 17); } - } - - /// - /// The 18th day of August of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 8, 18); } - } - - /// - /// The 19th day of August of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 8, 19); } - } - - /// - /// The 20th day of August of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 8, 20); } - } - - /// - /// The 21st day of August of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 8, 21); } - } - - /// - /// The 22nd day of August of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 8, 22); } - } - - /// - /// The 23rd day of August of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 8, 23); } - } - - /// - /// The 24th day of August of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 8, 24); } - } - - /// - /// The 25th day of August of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 8, 25); } - } - - /// - /// The 26th day of August of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 8, 26); } - } - - /// - /// The 27th day of August of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 8, 27); } - } - - /// - /// The 28th day of August of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 8, 28); } - } - - /// - /// The 29th day of August of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 8, 29); } - } - - /// - /// The 30th day of August of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 8, 30); } - } - - /// - /// The 31st day of August of the current year - /// - public static DateTime The31st - { - get { return new DateTime(DateTime.Now.Year, 8, 31); } - } - } - + public class August + { + /// + /// The nth day of August of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 8, dayNumber); + } + + /// + /// The 1st day of August of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 8, 1); } + } + + /// + /// The 2nd day of August of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 8, 2); } + } + + /// + /// The 3rd day of August of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 8, 3); } + } + + /// + /// The 4th day of August of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 8, 4); } + } + + /// + /// The 5th day of August of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 8, 5); } + } + + /// + /// The 6th day of August of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 8, 6); } + } + + /// + /// The 7th day of August of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 8, 7); } + } + + /// + /// The 8th day of August of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 8, 8); } + } + + /// + /// The 9th day of August of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 8, 9); } + } + + /// + /// The 10th day of August of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 8, 10); } + } + + /// + /// The 11th day of August of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 8, 11); } + } + + /// + /// The 12th day of August of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 8, 12); } + } + + /// + /// The 13th day of August of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 8, 13); } + } + + /// + /// The 14th day of August of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 8, 14); } + } + + /// + /// The 15th day of August of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 8, 15); } + } + + /// + /// The 16th day of August of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 8, 16); } + } + + /// + /// The 17th day of August of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 8, 17); } + } + + /// + /// The 18th day of August of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 8, 18); } + } + + /// + /// The 19th day of August of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 8, 19); } + } + + /// + /// The 20th day of August of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 8, 20); } + } + + /// + /// The 21st day of August of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 8, 21); } + } + + /// + /// The 22nd day of August of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 8, 22); } + } + + /// + /// The 23rd day of August of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 8, 23); } + } + + /// + /// The 24th day of August of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 8, 24); } + } + + /// + /// The 25th day of August of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 8, 25); } + } + + /// + /// The 26th day of August of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 8, 26); } + } + + /// + /// The 27th day of August of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 8, 27); } + } + + /// + /// The 28th day of August of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 8, 28); } + } + + /// + /// The 29th day of August of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 8, 29); } + } + + /// + /// The 30th day of August of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 8, 30); } + } + + /// + /// The 31st day of August of the current year + /// + public static DateTime The31st + { + get { return new DateTime(DateTime.Now.Year, 8, 31); } + } + } + /// - /// Provides fluent date accessors for September + /// Provides fluent date accessors for September /// - public class September - { - /// - /// The nth day of September of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 9, dayNumber); - } - - /// - /// The 1st day of September of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 9, 1); } - } - - /// - /// The 2nd day of September of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 9, 2); } - } - - /// - /// The 3rd day of September of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 9, 3); } - } - - /// - /// The 4th day of September of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 9, 4); } - } - - /// - /// The 5th day of September of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 9, 5); } - } - - /// - /// The 6th day of September of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 9, 6); } - } - - /// - /// The 7th day of September of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 9, 7); } - } - - /// - /// The 8th day of September of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 9, 8); } - } - - /// - /// The 9th day of September of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 9, 9); } - } - - /// - /// The 10th day of September of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 9, 10); } - } - - /// - /// The 11th day of September of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 9, 11); } - } - - /// - /// The 12th day of September of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 9, 12); } - } - - /// - /// The 13th day of September of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 9, 13); } - } - - /// - /// The 14th day of September of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 9, 14); } - } - - /// - /// The 15th day of September of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 9, 15); } - } - - /// - /// The 16th day of September of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 9, 16); } - } - - /// - /// The 17th day of September of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 9, 17); } - } - - /// - /// The 18th day of September of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 9, 18); } - } - - /// - /// The 19th day of September of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 9, 19); } - } - - /// - /// The 20th day of September of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 9, 20); } - } - - /// - /// The 21st day of September of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 9, 21); } - } - - /// - /// The 22nd day of September of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 9, 22); } - } - - /// - /// The 23rd day of September of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 9, 23); } - } - - /// - /// The 24th day of September of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 9, 24); } - } - - /// - /// The 25th day of September of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 9, 25); } - } - - /// - /// The 26th day of September of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 9, 26); } - } - - /// - /// The 27th day of September of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 9, 27); } - } - - /// - /// The 28th day of September of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 9, 28); } - } - - /// - /// The 29th day of September of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 9, 29); } - } - - /// - /// The 30th day of September of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 9, 30); } - } - } - + public class September + { + /// + /// The nth day of September of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 9, dayNumber); + } + + /// + /// The 1st day of September of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 9, 1); } + } + + /// + /// The 2nd day of September of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 9, 2); } + } + + /// + /// The 3rd day of September of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 9, 3); } + } + + /// + /// The 4th day of September of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 9, 4); } + } + + /// + /// The 5th day of September of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 9, 5); } + } + + /// + /// The 6th day of September of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 9, 6); } + } + + /// + /// The 7th day of September of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 9, 7); } + } + + /// + /// The 8th day of September of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 9, 8); } + } + + /// + /// The 9th day of September of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 9, 9); } + } + + /// + /// The 10th day of September of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 9, 10); } + } + + /// + /// The 11th day of September of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 9, 11); } + } + + /// + /// The 12th day of September of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 9, 12); } + } + + /// + /// The 13th day of September of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 9, 13); } + } + + /// + /// The 14th day of September of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 9, 14); } + } + + /// + /// The 15th day of September of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 9, 15); } + } + + /// + /// The 16th day of September of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 9, 16); } + } + + /// + /// The 17th day of September of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 9, 17); } + } + + /// + /// The 18th day of September of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 9, 18); } + } + + /// + /// The 19th day of September of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 9, 19); } + } + + /// + /// The 20th day of September of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 9, 20); } + } + + /// + /// The 21st day of September of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 9, 21); } + } + + /// + /// The 22nd day of September of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 9, 22); } + } + + /// + /// The 23rd day of September of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 9, 23); } + } + + /// + /// The 24th day of September of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 9, 24); } + } + + /// + /// The 25th day of September of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 9, 25); } + } + + /// + /// The 26th day of September of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 9, 26); } + } + + /// + /// The 27th day of September of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 9, 27); } + } + + /// + /// The 28th day of September of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 9, 28); } + } + + /// + /// The 29th day of September of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 9, 29); } + } + + /// + /// The 30th day of September of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 9, 30); } + } + } + /// - /// Provides fluent date accessors for October + /// Provides fluent date accessors for October /// - public class October - { - /// - /// The nth day of October of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 10, dayNumber); - } - - /// - /// The 1st day of October of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 10, 1); } - } - - /// - /// The 2nd day of October of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 10, 2); } - } - - /// - /// The 3rd day of October of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 10, 3); } - } - - /// - /// The 4th day of October of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 10, 4); } - } - - /// - /// The 5th day of October of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 10, 5); } - } - - /// - /// The 6th day of October of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 10, 6); } - } - - /// - /// The 7th day of October of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 10, 7); } - } - - /// - /// The 8th day of October of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 10, 8); } - } - - /// - /// The 9th day of October of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 10, 9); } - } - - /// - /// The 10th day of October of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 10, 10); } - } - - /// - /// The 11th day of October of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 10, 11); } - } - - /// - /// The 12th day of October of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 10, 12); } - } - - /// - /// The 13th day of October of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 10, 13); } - } - - /// - /// The 14th day of October of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 10, 14); } - } - - /// - /// The 15th day of October of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 10, 15); } - } - - /// - /// The 16th day of October of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 10, 16); } - } - - /// - /// The 17th day of October of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 10, 17); } - } - - /// - /// The 18th day of October of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 10, 18); } - } - - /// - /// The 19th day of October of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 10, 19); } - } - - /// - /// The 20th day of October of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 10, 20); } - } - - /// - /// The 21st day of October of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 10, 21); } - } - - /// - /// The 22nd day of October of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 10, 22); } - } - - /// - /// The 23rd day of October of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 10, 23); } - } - - /// - /// The 24th day of October of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 10, 24); } - } - - /// - /// The 25th day of October of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 10, 25); } - } - - /// - /// The 26th day of October of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 10, 26); } - } - - /// - /// The 27th day of October of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 10, 27); } - } - - /// - /// The 28th day of October of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 10, 28); } - } - - /// - /// The 29th day of October of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 10, 29); } - } - - /// - /// The 30th day of October of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 10, 30); } - } - - /// - /// The 31st day of October of the current year - /// - public static DateTime The31st - { - get { return new DateTime(DateTime.Now.Year, 10, 31); } - } - } - + public class October + { + /// + /// The nth day of October of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 10, dayNumber); + } + + /// + /// The 1st day of October of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 10, 1); } + } + + /// + /// The 2nd day of October of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 10, 2); } + } + + /// + /// The 3rd day of October of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 10, 3); } + } + + /// + /// The 4th day of October of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 10, 4); } + } + + /// + /// The 5th day of October of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 10, 5); } + } + + /// + /// The 6th day of October of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 10, 6); } + } + + /// + /// The 7th day of October of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 10, 7); } + } + + /// + /// The 8th day of October of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 10, 8); } + } + + /// + /// The 9th day of October of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 10, 9); } + } + + /// + /// The 10th day of October of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 10, 10); } + } + + /// + /// The 11th day of October of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 10, 11); } + } + + /// + /// The 12th day of October of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 10, 12); } + } + + /// + /// The 13th day of October of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 10, 13); } + } + + /// + /// The 14th day of October of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 10, 14); } + } + + /// + /// The 15th day of October of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 10, 15); } + } + + /// + /// The 16th day of October of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 10, 16); } + } + + /// + /// The 17th day of October of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 10, 17); } + } + + /// + /// The 18th day of October of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 10, 18); } + } + + /// + /// The 19th day of October of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 10, 19); } + } + + /// + /// The 20th day of October of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 10, 20); } + } + + /// + /// The 21st day of October of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 10, 21); } + } + + /// + /// The 22nd day of October of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 10, 22); } + } + + /// + /// The 23rd day of October of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 10, 23); } + } + + /// + /// The 24th day of October of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 10, 24); } + } + + /// + /// The 25th day of October of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 10, 25); } + } + + /// + /// The 26th day of October of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 10, 26); } + } + + /// + /// The 27th day of October of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 10, 27); } + } + + /// + /// The 28th day of October of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 10, 28); } + } + + /// + /// The 29th day of October of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 10, 29); } + } + + /// + /// The 30th day of October of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 10, 30); } + } + + /// + /// The 31st day of October of the current year + /// + public static DateTime The31st + { + get { return new DateTime(DateTime.Now.Year, 10, 31); } + } + } + /// - /// Provides fluent date accessors for November + /// Provides fluent date accessors for November /// - public class November - { - /// - /// The nth day of November of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 11, dayNumber); - } - - /// - /// The 1st day of November of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 11, 1); } - } - - /// - /// The 2nd day of November of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 11, 2); } - } - - /// - /// The 3rd day of November of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 11, 3); } - } - - /// - /// The 4th day of November of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 11, 4); } - } - - /// - /// The 5th day of November of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 11, 5); } - } - - /// - /// The 6th day of November of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 11, 6); } - } - - /// - /// The 7th day of November of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 11, 7); } - } - - /// - /// The 8th day of November of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 11, 8); } - } - - /// - /// The 9th day of November of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 11, 9); } - } - - /// - /// The 10th day of November of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 11, 10); } - } - - /// - /// The 11th day of November of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 11, 11); } - } - - /// - /// The 12th day of November of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 11, 12); } - } - - /// - /// The 13th day of November of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 11, 13); } - } - - /// - /// The 14th day of November of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 11, 14); } - } - - /// - /// The 15th day of November of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 11, 15); } - } - - /// - /// The 16th day of November of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 11, 16); } - } - - /// - /// The 17th day of November of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 11, 17); } - } - - /// - /// The 18th day of November of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 11, 18); } - } - - /// - /// The 19th day of November of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 11, 19); } - } - - /// - /// The 20th day of November of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 11, 20); } - } - - /// - /// The 21st day of November of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 11, 21); } - } - - /// - /// The 22nd day of November of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 11, 22); } - } - - /// - /// The 23rd day of November of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 11, 23); } - } - - /// - /// The 24th day of November of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 11, 24); } - } - - /// - /// The 25th day of November of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 11, 25); } - } - - /// - /// The 26th day of November of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 11, 26); } - } - - /// - /// The 27th day of November of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 11, 27); } - } - - /// - /// The 28th day of November of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 11, 28); } - } - - /// - /// The 29th day of November of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 11, 29); } - } - - /// - /// The 30th day of November of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 11, 30); } - } - } - + public class November + { + /// + /// The nth day of November of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 11, dayNumber); + } + + /// + /// The 1st day of November of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 11, 1); } + } + + /// + /// The 2nd day of November of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 11, 2); } + } + + /// + /// The 3rd day of November of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 11, 3); } + } + + /// + /// The 4th day of November of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 11, 4); } + } + + /// + /// The 5th day of November of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 11, 5); } + } + + /// + /// The 6th day of November of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 11, 6); } + } + + /// + /// The 7th day of November of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 11, 7); } + } + + /// + /// The 8th day of November of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 11, 8); } + } + + /// + /// The 9th day of November of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 11, 9); } + } + + /// + /// The 10th day of November of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 11, 10); } + } + + /// + /// The 11th day of November of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 11, 11); } + } + + /// + /// The 12th day of November of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 11, 12); } + } + + /// + /// The 13th day of November of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 11, 13); } + } + + /// + /// The 14th day of November of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 11, 14); } + } + + /// + /// The 15th day of November of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 11, 15); } + } + + /// + /// The 16th day of November of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 11, 16); } + } + + /// + /// The 17th day of November of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 11, 17); } + } + + /// + /// The 18th day of November of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 11, 18); } + } + + /// + /// The 19th day of November of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 11, 19); } + } + + /// + /// The 20th day of November of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 11, 20); } + } + + /// + /// The 21st day of November of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 11, 21); } + } + + /// + /// The 22nd day of November of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 11, 22); } + } + + /// + /// The 23rd day of November of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 11, 23); } + } + + /// + /// The 24th day of November of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 11, 24); } + } + + /// + /// The 25th day of November of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 11, 25); } + } + + /// + /// The 26th day of November of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 11, 26); } + } + + /// + /// The 27th day of November of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 11, 27); } + } + + /// + /// The 28th day of November of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 11, 28); } + } + + /// + /// The 29th day of November of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 11, 29); } + } + + /// + /// The 30th day of November of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 11, 30); } + } + } + /// - /// Provides fluent date accessors for December + /// Provides fluent date accessors for December /// - public class December - { - /// - /// The nth day of December of the current year - /// - public static DateTime The(int dayNumber) - { - return new DateTime(DateTime.Now.Year, 12, dayNumber); - } - - /// - /// The 1st day of December of the current year - /// - public static DateTime The1st - { - get { return new DateTime(DateTime.Now.Year, 12, 1); } - } - - /// - /// The 2nd day of December of the current year - /// - public static DateTime The2nd - { - get { return new DateTime(DateTime.Now.Year, 12, 2); } - } - - /// - /// The 3rd day of December of the current year - /// - public static DateTime The3rd - { - get { return new DateTime(DateTime.Now.Year, 12, 3); } - } - - /// - /// The 4th day of December of the current year - /// - public static DateTime The4th - { - get { return new DateTime(DateTime.Now.Year, 12, 4); } - } - - /// - /// The 5th day of December of the current year - /// - public static DateTime The5th - { - get { return new DateTime(DateTime.Now.Year, 12, 5); } - } - - /// - /// The 6th day of December of the current year - /// - public static DateTime The6th - { - get { return new DateTime(DateTime.Now.Year, 12, 6); } - } - - /// - /// The 7th day of December of the current year - /// - public static DateTime The7th - { - get { return new DateTime(DateTime.Now.Year, 12, 7); } - } - - /// - /// The 8th day of December of the current year - /// - public static DateTime The8th - { - get { return new DateTime(DateTime.Now.Year, 12, 8); } - } - - /// - /// The 9th day of December of the current year - /// - public static DateTime The9th - { - get { return new DateTime(DateTime.Now.Year, 12, 9); } - } - - /// - /// The 10th day of December of the current year - /// - public static DateTime The10th - { - get { return new DateTime(DateTime.Now.Year, 12, 10); } - } - - /// - /// The 11th day of December of the current year - /// - public static DateTime The11th - { - get { return new DateTime(DateTime.Now.Year, 12, 11); } - } - - /// - /// The 12th day of December of the current year - /// - public static DateTime The12th - { - get { return new DateTime(DateTime.Now.Year, 12, 12); } - } - - /// - /// The 13th day of December of the current year - /// - public static DateTime The13th - { - get { return new DateTime(DateTime.Now.Year, 12, 13); } - } - - /// - /// The 14th day of December of the current year - /// - public static DateTime The14th - { - get { return new DateTime(DateTime.Now.Year, 12, 14); } - } - - /// - /// The 15th day of December of the current year - /// - public static DateTime The15th - { - get { return new DateTime(DateTime.Now.Year, 12, 15); } - } - - /// - /// The 16th day of December of the current year - /// - public static DateTime The16th - { - get { return new DateTime(DateTime.Now.Year, 12, 16); } - } - - /// - /// The 17th day of December of the current year - /// - public static DateTime The17th - { - get { return new DateTime(DateTime.Now.Year, 12, 17); } - } - - /// - /// The 18th day of December of the current year - /// - public static DateTime The18th - { - get { return new DateTime(DateTime.Now.Year, 12, 18); } - } - - /// - /// The 19th day of December of the current year - /// - public static DateTime The19th - { - get { return new DateTime(DateTime.Now.Year, 12, 19); } - } - - /// - /// The 20th day of December of the current year - /// - public static DateTime The20th - { - get { return new DateTime(DateTime.Now.Year, 12, 20); } - } - - /// - /// The 21st day of December of the current year - /// - public static DateTime The21st - { - get { return new DateTime(DateTime.Now.Year, 12, 21); } - } - - /// - /// The 22nd day of December of the current year - /// - public static DateTime The22nd - { - get { return new DateTime(DateTime.Now.Year, 12, 22); } - } - - /// - /// The 23rd day of December of the current year - /// - public static DateTime The23rd - { - get { return new DateTime(DateTime.Now.Year, 12, 23); } - } - - /// - /// The 24th day of December of the current year - /// - public static DateTime The24th - { - get { return new DateTime(DateTime.Now.Year, 12, 24); } - } - - /// - /// The 25th day of December of the current year - /// - public static DateTime The25th - { - get { return new DateTime(DateTime.Now.Year, 12, 25); } - } - - /// - /// The 26th day of December of the current year - /// - public static DateTime The26th - { - get { return new DateTime(DateTime.Now.Year, 12, 26); } - } - - /// - /// The 27th day of December of the current year - /// - public static DateTime The27th - { - get { return new DateTime(DateTime.Now.Year, 12, 27); } - } - - /// - /// The 28th day of December of the current year - /// - public static DateTime The28th - { - get { return new DateTime(DateTime.Now.Year, 12, 28); } - } - - /// - /// The 29th day of December of the current year - /// - public static DateTime The29th - { - get { return new DateTime(DateTime.Now.Year, 12, 29); } - } - - /// - /// The 30th day of December of the current year - /// - public static DateTime The30th - { - get { return new DateTime(DateTime.Now.Year, 12, 30); } - } - - /// - /// The 31st day of December of the current year - /// - public static DateTime The31st - { - get { return new DateTime(DateTime.Now.Year, 12, 31); } - } - } - } + public class December + { + /// + /// The nth day of December of the current year + /// + public static DateTime The(int dayNumber) + { + return new DateTime(DateTime.Now.Year, 12, dayNumber); + } + + /// + /// The 1st day of December of the current year + /// + public static DateTime The1st + { + get { return new DateTime(DateTime.Now.Year, 12, 1); } + } + + /// + /// The 2nd day of December of the current year + /// + public static DateTime The2nd + { + get { return new DateTime(DateTime.Now.Year, 12, 2); } + } + + /// + /// The 3rd day of December of the current year + /// + public static DateTime The3rd + { + get { return new DateTime(DateTime.Now.Year, 12, 3); } + } + + /// + /// The 4th day of December of the current year + /// + public static DateTime The4th + { + get { return new DateTime(DateTime.Now.Year, 12, 4); } + } + + /// + /// The 5th day of December of the current year + /// + public static DateTime The5th + { + get { return new DateTime(DateTime.Now.Year, 12, 5); } + } + + /// + /// The 6th day of December of the current year + /// + public static DateTime The6th + { + get { return new DateTime(DateTime.Now.Year, 12, 6); } + } + + /// + /// The 7th day of December of the current year + /// + public static DateTime The7th + { + get { return new DateTime(DateTime.Now.Year, 12, 7); } + } + + /// + /// The 8th day of December of the current year + /// + public static DateTime The8th + { + get { return new DateTime(DateTime.Now.Year, 12, 8); } + } + + /// + /// The 9th day of December of the current year + /// + public static DateTime The9th + { + get { return new DateTime(DateTime.Now.Year, 12, 9); } + } + + /// + /// The 10th day of December of the current year + /// + public static DateTime The10th + { + get { return new DateTime(DateTime.Now.Year, 12, 10); } + } + + /// + /// The 11th day of December of the current year + /// + public static DateTime The11th + { + get { return new DateTime(DateTime.Now.Year, 12, 11); } + } + + /// + /// The 12th day of December of the current year + /// + public static DateTime The12th + { + get { return new DateTime(DateTime.Now.Year, 12, 12); } + } + + /// + /// The 13th day of December of the current year + /// + public static DateTime The13th + { + get { return new DateTime(DateTime.Now.Year, 12, 13); } + } + + /// + /// The 14th day of December of the current year + /// + public static DateTime The14th + { + get { return new DateTime(DateTime.Now.Year, 12, 14); } + } + + /// + /// The 15th day of December of the current year + /// + public static DateTime The15th + { + get { return new DateTime(DateTime.Now.Year, 12, 15); } + } + + /// + /// The 16th day of December of the current year + /// + public static DateTime The16th + { + get { return new DateTime(DateTime.Now.Year, 12, 16); } + } + + /// + /// The 17th day of December of the current year + /// + public static DateTime The17th + { + get { return new DateTime(DateTime.Now.Year, 12, 17); } + } + + /// + /// The 18th day of December of the current year + /// + public static DateTime The18th + { + get { return new DateTime(DateTime.Now.Year, 12, 18); } + } + + /// + /// The 19th day of December of the current year + /// + public static DateTime The19th + { + get { return new DateTime(DateTime.Now.Year, 12, 19); } + } + + /// + /// The 20th day of December of the current year + /// + public static DateTime The20th + { + get { return new DateTime(DateTime.Now.Year, 12, 20); } + } + + /// + /// The 21st day of December of the current year + /// + public static DateTime The21st + { + get { return new DateTime(DateTime.Now.Year, 12, 21); } + } + + /// + /// The 22nd day of December of the current year + /// + public static DateTime The22nd + { + get { return new DateTime(DateTime.Now.Year, 12, 22); } + } + + /// + /// The 23rd day of December of the current year + /// + public static DateTime The23rd + { + get { return new DateTime(DateTime.Now.Year, 12, 23); } + } + + /// + /// The 24th day of December of the current year + /// + public static DateTime The24th + { + get { return new DateTime(DateTime.Now.Year, 12, 24); } + } + + /// + /// The 25th day of December of the current year + /// + public static DateTime The25th + { + get { return new DateTime(DateTime.Now.Year, 12, 25); } + } + + /// + /// The 26th day of December of the current year + /// + public static DateTime The26th + { + get { return new DateTime(DateTime.Now.Year, 12, 26); } + } + + /// + /// The 27th day of December of the current year + /// + public static DateTime The27th + { + get { return new DateTime(DateTime.Now.Year, 12, 27); } + } + + /// + /// The 28th day of December of the current year + /// + public static DateTime The28th + { + get { return new DateTime(DateTime.Now.Year, 12, 28); } + } + + /// + /// The 29th day of December of the current year + /// + public static DateTime The29th + { + get { return new DateTime(DateTime.Now.Year, 12, 29); } + } + + /// + /// The 30th day of December of the current year + /// + public static DateTime The30th + { + get { return new DateTime(DateTime.Now.Year, 12, 30); } + } + + /// + /// The 31st day of December of the current year + /// + public static DateTime The31st + { + get { return new DateTime(DateTime.Now.Year, 12, 31); } + } + } + } } \ No newline at end of file diff --git a/src/Humanizer/HeadingExtensions.cs b/src/Humanizer/HeadingExtensions.cs index 6ee03cbd3..2bb524874 100644 --- a/src/Humanizer/HeadingExtensions.cs +++ b/src/Humanizer/HeadingExtensions.cs @@ -38,13 +38,16 @@ public static class HeadingExtensions /// A textual representation of the heading /// The culture to return the textual representation in /// Whether to return a short result or not. - public static string ToHeading(this double heading, HeadingStyle style = HeadingStyle.Abbreviated, CultureInfo culture = null) { - int val = (int)((heading / 22.5) + .5); + public static string ToHeading(this double heading, HeadingStyle style = HeadingStyle.Abbreviated, CultureInfo culture = null) + { + var val = (int)((heading / 22.5) + .5); - string result = headings[val % 16]; + var result = headings[val % 16]; if (style == HeadingStyle.Abbreviated) + { return Resources.GetResource($"{result}_Short", culture); + } result = Resources.GetResource(result, culture); return result; @@ -56,8 +59,9 @@ public static string ToHeading(this double heading, HeadingStyle style = Heading /// This representation has a maximum deviation of 22.5 degrees. /// /// The heading arrow. - public static char ToHeadingArrow(this double heading) { - int val = (int)((heading / 45) + .5); + public static char ToHeadingArrow(this double heading) + { + var val = (int)((heading / 45) + .5); return headingArrows[val % 8]; } @@ -66,10 +70,14 @@ public static char ToHeadingArrow(this double heading) { /// Returns a heading based on the short textual representation of the heading. /// /// The heading. -1 if the heading could not be parsed. - public static double FromAbbreviatedHeading(this string heading) { + public static double FromAbbreviatedHeading(this string heading) + { var index = Array.IndexOf(headings, heading.ToUpperInvariant()); - if (index == -1) return -1; + if (index == -1) + { + return -1; + } return (index * 22.5); } diff --git a/src/Humanizer/Inflections/Vocabulary.cs b/src/Humanizer/Inflections/Vocabulary.cs index 410163495..9dd1f83ef 100644 --- a/src/Humanizer/Inflections/Vocabulary.cs +++ b/src/Humanizer/Inflections/Vocabulary.cs @@ -78,12 +78,16 @@ public string Pluralize(string word, bool inputIsKnownToBeSingular = true) var result = ApplyRules(_plurals, word); if (inputIsKnownToBeSingular) + { return result; + } var asSingular = ApplyRules(_singulars, word); var asSingularAsPlural = ApplyRules(_plurals, asSingular); if (asSingular != null && asSingular != word && asSingular + "s" != word && asSingularAsPlural == word && result != word) + { return word; + } return result; } @@ -99,13 +103,17 @@ public string Singularize(string word, bool inputIsKnownToBePlural = true) var result = ApplyRules(_singulars, word); if (inputIsKnownToBePlural) + { return result; + } // the Plurality is unknown so we should check all possibilities var asPlural = ApplyRules(_plurals, word); var asPluralAsSingular = ApplyRules(_singulars, asPlural); if (asPlural != word && word + "s" != asPlural && asPluralAsSingular == word && result != word) + { return word; + } return result ?? word; } @@ -113,16 +121,22 @@ public string Singularize(string word, bool inputIsKnownToBePlural = true) private string ApplyRules(IList rules, string word) { if (word == null) + { return null; + } if (IsUncountable(word)) + { return word; + } var result = word; for (var i = rules.Count - 1; i >= 0; i--) { if ((result = rules[i].Apply(word)) != null) + { break; + } } return result; } @@ -146,7 +160,9 @@ public Rule(string pattern, string replacement) public string Apply(string word) { if (!_regex.IsMatch(word)) + { return null; + } return _regex.Replace(word, _replacement); } diff --git a/src/Humanizer/InflectorExtensions.cs b/src/Humanizer/InflectorExtensions.cs index 952e40fa6..0f2f0c93c 100644 --- a/src/Humanizer/InflectorExtensions.cs +++ b/src/Humanizer/InflectorExtensions.cs @@ -21,7 +21,6 @@ //IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN //CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -using System; using System.Text.RegularExpressions; using Humanizer.Inflections; @@ -106,7 +105,7 @@ public static string Dasherize(this string underscoredWord) { return underscoredWord.Replace('_', '-'); } - + /// /// Replaces underscores with hyphens in the string /// diff --git a/src/Humanizer/Localisation/CollectionFormatters/DefaultCollectionFormatter.cs b/src/Humanizer/Localisation/CollectionFormatters/DefaultCollectionFormatter.cs index 09a7558c3..494bb4304 100644 --- a/src/Humanizer/Localisation/CollectionFormatters/DefaultCollectionFormatter.cs +++ b/src/Humanizer/Localisation/CollectionFormatters/DefaultCollectionFormatter.cs @@ -4,7 +4,7 @@ namespace Humanizer.Localisation.CollectionFormatters { - class DefaultCollectionFormatter : ICollectionFormatter + internal class DefaultCollectionFormatter : ICollectionFormatter { protected string DefaultSeparator = ""; @@ -35,8 +35,15 @@ public virtual string Humanize(IEnumerable collection, string separator) public virtual string Humanize(IEnumerable collection, Func objectFormatter, string separator) { - if (collection == null) throw new ArgumentNullException(nameof(collection)); - if (objectFormatter == null) throw new ArgumentNullException(nameof(objectFormatter)); + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + if (objectFormatter == null) + { + throw new ArgumentNullException(nameof(objectFormatter)); + } return HumanizeDisplayStrings( collection.Select(objectFormatter), @@ -45,8 +52,15 @@ public virtual string Humanize(IEnumerable collection, Func obj public string Humanize(IEnumerable collection, Func objectFormatter, string separator) { - if (collection == null) throw new ArgumentNullException(nameof(collection)); - if (objectFormatter == null) throw new ArgumentNullException(nameof(objectFormatter)); + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + if (objectFormatter == null) + { + throw new ArgumentNullException(nameof(objectFormatter)); + } return HumanizeDisplayStrings( collection.Select(objectFormatter).Select(o => o?.ToString()), @@ -63,10 +77,14 @@ private string HumanizeDisplayStrings(IEnumerable strings, string separa var count = itemsArray.Length; if (count == 0) + { return ""; + } if (count == 1) + { return itemsArray[0]; + } var itemsBeforeLast = itemsArray.Take(count - 1); var lastItem = itemsArray.Skip(count - 1).First(); diff --git a/src/Humanizer/Localisation/CollectionFormatters/OxfordStyleCollectionFormatter.cs b/src/Humanizer/Localisation/CollectionFormatters/OxfordStyleCollectionFormatter.cs index 2c3a72613..0a4529131 100644 --- a/src/Humanizer/Localisation/CollectionFormatters/OxfordStyleCollectionFormatter.cs +++ b/src/Humanizer/Localisation/CollectionFormatters/OxfordStyleCollectionFormatter.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Humanizer.Localisation.CollectionFormatters +namespace Humanizer.Localisation.CollectionFormatters { internal class OxfordStyleCollectionFormatter : DefaultCollectionFormatter { diff --git a/src/Humanizer/Localisation/DateToOrdinalWords/DefaultDateToOrdinalWordConverter.cs b/src/Humanizer/Localisation/DateToOrdinalWords/DefaultDateToOrdinalWordConverter.cs index 7b9f82ab2..da6e19b65 100644 --- a/src/Humanizer/Localisation/DateToOrdinalWords/DefaultDateToOrdinalWordConverter.cs +++ b/src/Humanizer/Localisation/DateToOrdinalWords/DefaultDateToOrdinalWordConverter.cs @@ -14,6 +14,6 @@ public virtual string Convert(DateTime date, GrammaticalCase grammaticalCase) { return Convert(date); } - + } } \ No newline at end of file diff --git a/src/Humanizer/Localisation/Formatters/ArabicFormatter.cs b/src/Humanizer/Localisation/Formatters/ArabicFormatter.cs index fb210e91d..1e1e60746 100644 --- a/src/Humanizer/Localisation/Formatters/ArabicFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/ArabicFormatter.cs @@ -14,11 +14,15 @@ protected override string GetResourceKey(string resourceKey, int number) { //In Arabic pluralization 2 entities gets a different word. if (number == 2) + { return resourceKey + DualPostfix; + } //In Arabic pluralization entities where the count is between 3 and 10 gets a different word. - if (number >= 3 && number <= 10 ) + if (number >= 3 && number <= 10) + { return resourceKey + PluralPostfix; + } return resourceKey; } diff --git a/src/Humanizer/Localisation/Formatters/CroatianFormatter.cs b/src/Humanizer/Localisation/Formatters/CroatianFormatter.cs index c9592752a..b01b0389a 100644 --- a/src/Humanizer/Localisation/Formatters/CroatianFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/CroatianFormatter.cs @@ -12,7 +12,9 @@ public CroatianFormatter() protected override string GetResourceKey(string resourceKey, int number) { if ((number % 10 == 2 || number % 10 == 3 || number % 10 == 4) && number != 12 && number != 13 && number != 14) + { return resourceKey + DualTrialQuadralPostfix; + } return resourceKey; } diff --git a/src/Humanizer/Localisation/Formatters/CzechSlovakPolishFormatter.cs b/src/Humanizer/Localisation/Formatters/CzechSlovakPolishFormatter.cs index 4cd4d7d56..53f074478 100644 --- a/src/Humanizer/Localisation/Formatters/CzechSlovakPolishFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/CzechSlovakPolishFormatter.cs @@ -11,9 +11,11 @@ public CzechSlovakPolishFormatter(string localeCode) protected override string GetResourceKey(string resourceKey, int number) { - if (number > 1 && number < 5) + if (number > 1 && number < 5) + { return resourceKey + PaucalPostfix; - + } + return resourceKey; } } diff --git a/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs b/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs index 5acd05d5b..6b9f78eb6 100644 --- a/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/DefaultFormatter.cs @@ -94,7 +94,9 @@ protected virtual string Format(string resourceKey) var resourceString = Resources.GetResource(GetResourceKey(resourceKey), _culture); if (string.IsNullOrEmpty(resourceString)) + { throw new ArgumentException($"The resource object with key '{resourceKey}' was not found", nameof(resourceKey)); + } return resourceString; } @@ -112,7 +114,9 @@ protected virtual string Format(string resourceKey, int number, bool toWords = f var resourceString = Resources.GetResource(GetResourceKey(resourceKey, number), _culture); if (string.IsNullOrEmpty(resourceString)) + { throw new ArgumentException($"The resource object with key '{resourceKey}' was not found", nameof(resourceKey)); + } return toWords ? resourceString.FormatWith(number.ToWords()) diff --git a/src/Humanizer/Localisation/Formatters/FrenchFormatter.cs b/src/Humanizer/Localisation/Formatters/FrenchFormatter.cs index b6ec51d12..706770e6a 100644 --- a/src/Humanizer/Localisation/Formatters/FrenchFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/FrenchFormatter.cs @@ -3,7 +3,7 @@ internal class FrenchFormatter : DefaultFormatter { private const string DualPostfix = "_Dual"; - + public FrenchFormatter(string localeCode) : base(localeCode) { @@ -12,7 +12,9 @@ public FrenchFormatter(string localeCode) protected override string GetResourceKey(string resourceKey, int number) { if (number == 2 && (resourceKey == "DateHumanize_MultipleDaysAgo" || resourceKey == "DateHumanize_MultipleDaysFromNow")) + { return resourceKey + DualPostfix; + } return resourceKey; } diff --git a/src/Humanizer/Localisation/Formatters/HebrewFormatter.cs b/src/Humanizer/Localisation/Formatters/HebrewFormatter.cs index ef151ef2c..d0ebdca35 100644 --- a/src/Humanizer/Localisation/Formatters/HebrewFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/HebrewFormatter.cs @@ -14,12 +14,16 @@ protected override string GetResourceKey(string resourceKey, int number) { //In Hebrew pluralization 2 entities gets a different word. if (number == 2) + { return resourceKey + DualPostfix; + } //In Hebrew pluralization entities where the count is between 3 and 10 gets a different word. //See http://lib.cet.ac.il/pages/item.asp?item=21585 for explanation if (number >= 3 && number <= 10) + { return resourceKey + PluralPostfix; + } return resourceKey; } diff --git a/src/Humanizer/Localisation/Formatters/RussianFormatter.cs b/src/Humanizer/Localisation/Formatters/RussianFormatter.cs index 14f054706..ceb4e0c56 100644 --- a/src/Humanizer/Localisation/Formatters/RussianFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/RussianFormatter.cs @@ -19,9 +19,15 @@ protected override string GetResourceKey(string resourceKey, int number) private string GetSuffix(RussianGrammaticalNumber grammaticalNumber) { if (grammaticalNumber == RussianGrammaticalNumber.Singular) + { return "_Singular"; + } + if (grammaticalNumber == RussianGrammaticalNumber.Paucal) + { return "_Paucal"; + } + return ""; } } diff --git a/src/Humanizer/Localisation/Formatters/SerbianFormatter.cs b/src/Humanizer/Localisation/Formatters/SerbianFormatter.cs index 728ae4641..d4f03e11d 100644 --- a/src/Humanizer/Localisation/Formatters/SerbianFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/SerbianFormatter.cs @@ -13,9 +13,11 @@ protected override string GetResourceKey(string resourceKey, int number) { var mod10 = number % 10; - if (mod10 > 1 && mod10 < 5) + if (mod10 > 1 && mod10 < 5) + { return resourceKey + PaucalPostfix; - + } + return resourceKey; } } diff --git a/src/Humanizer/Localisation/Formatters/SlovenianFormatter.cs b/src/Humanizer/Localisation/Formatters/SlovenianFormatter.cs index 249f1da56..0c2d32568 100644 --- a/src/Humanizer/Localisation/Formatters/SlovenianFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/SlovenianFormatter.cs @@ -13,11 +13,15 @@ public SlovenianFormatter() protected override string GetResourceKey(string resourceKey, int number) { if (number == 2) + { return resourceKey + DualPostfix; - + } + // When the count is three or four some some words have a different form when counting in Slovenian language if (number == 3 || number == 4) + { return resourceKey + TrialQuadralPostfix; + } return resourceKey; } diff --git a/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs b/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs index 23d2e102b..af0cd37bc 100644 --- a/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs +++ b/src/Humanizer/Localisation/Formatters/UkrainianFormatter.cs @@ -19,9 +19,15 @@ protected override string GetResourceKey(string resourceKey, int number) private string GetSuffix(RussianGrammaticalNumber grammaticalNumber) { if (grammaticalNumber == RussianGrammaticalNumber.Singular) + { return "_Singular"; + } + if (grammaticalNumber == RussianGrammaticalNumber.Paucal) + { return "_Paucal"; + } + return ""; } } diff --git a/src/Humanizer/Localisation/GrammaticalNumber/RussianGrammaticalNumberDetector.cs b/src/Humanizer/Localisation/GrammaticalNumber/RussianGrammaticalNumberDetector.cs index 520e69b2c..e6baadc92 100644 --- a/src/Humanizer/Localisation/GrammaticalNumber/RussianGrammaticalNumberDetector.cs +++ b/src/Humanizer/Localisation/GrammaticalNumber/RussianGrammaticalNumberDetector.cs @@ -10,10 +10,14 @@ public static RussianGrammaticalNumber Detect(int number) var unity = number % 10; if (unity == 1) // 1, 21, 31, 41 ... 91, 101, 121 ... + { return RussianGrammaticalNumber.Singular; + } if (unity > 1 && unity < 5) // 2, 3, 4, 22, 23, 24 ... + { return RussianGrammaticalNumber.Paucal; + } } return RussianGrammaticalNumber.Plural; diff --git a/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs index cff3559c1..ba56b625b 100644 --- a/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/AfrikaansNumberToWordsConverter.cs @@ -24,7 +24,7 @@ internal class AfrikaansNumberToWordsConverter : GenderlessNumberToWordsConverte public override string Convert(long number) { - if(number > Int32.MaxValue|| number < Int32.MinValue) + if (number > Int32.MaxValue || number < Int32.MinValue) { throw new NotImplementedException(); } @@ -39,10 +39,14 @@ public override string ConvertToOrdinal(int number) private string Convert(int number, bool isOrdinal) { if (number == 0) + { return GetUnitValue(0, isOrdinal); + } if (number < 0) + { return string.Format("minus {0}", Convert(-number)); + } var parts = new List(); @@ -78,30 +82,43 @@ private string Convert(int number, bool isOrdinal) if (number < 20) { if (parts.Count > 0) - parts.Add("en"); + { + parts.Add("en"); + } + parts.Add(GetUnitValue(number, isOrdinal)); } else { - var lastPartValue = (number/10)*10; - var lastPart = TensMap[number/10]; - if ((number%10) > 0) - lastPart = string.Format("{0} en {1}",GetUnitValue(number % 10, false), isOrdinal ? GetUnitValue(lastPartValue, isOrdinal) : lastPart); - else if ((number%10) == 0) + var lastPartValue = (number / 10) * 10; + var lastPart = TensMap[number / 10]; + if ((number % 10) > 0) + { + lastPart = string.Format("{0} en {1}", GetUnitValue(number % 10, false), isOrdinal ? GetUnitValue(lastPartValue, isOrdinal) : lastPart); + } + else if ((number % 10) == 0) + { lastPart = string.Format("{0}{1}{2}", parts.Count > 0 ? "en " : "", lastPart, isOrdinal ? "ste" : ""); + } else if (isOrdinal) + { lastPart = lastPart.TrimEnd('~') + "ste"; + } parts.Add(lastPart); } } else if (isOrdinal) + { parts[parts.Count - 1] += "ste"; + } var toWords = string.Join(" ", parts.ToArray()); if (isOrdinal) + { toWords = RemoveOnePrefix(toWords); + } return toWords; } @@ -111,22 +128,34 @@ private static string GetUnitValue(int number, bool isOrdinal) if (isOrdinal) { if (ExceptionNumbersToWords(number, out var exceptionString)) + { return exceptionString; + } else if (number > 19) - return TensMap[number/10] + "ste"; + { + return TensMap[number / 10] + "ste"; + } else + { return UnitsMap[number] + "de"; + } } else + { return UnitsMap[number]; + } } private static string RemoveOnePrefix(string toWords) { // one hundred => hundredth if (toWords.IndexOf("een", StringComparison.Ordinal) == 0) + { if (toWords.IndexOf("een en", StringComparison.Ordinal) != 0) + { toWords = toWords.Remove(0, 4); + } + } return toWords; } diff --git a/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs index a3fd652df..ae7f5f3a3 100644 --- a/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ArabicNumberToWordsConverter.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; namespace Humanizer.Localisation.NumberToWords @@ -20,9 +19,14 @@ internal class ArabicNumberToWordsConverter : GenderedNumberToWordsConverter public override string Convert(long number, GrammaticalGender gender) { if (number == 0) + { return "صفر"; + } + if (number < 0) + { return string.Format("ناقص {0}", Convert(-number, gender)); + } var result = string.Empty; var groupLevel = 0; @@ -39,9 +43,13 @@ public override string Convert(long number, GrammaticalGender gender) if (hundreds > 0) { if (tens == 0 && hundreds == 2) + { process = AppendedTwos[0]; + } else + { process = HundredsGroup[hundreds]; + } } if (tens > 0) @@ -51,19 +59,29 @@ public override string Convert(long number, GrammaticalGender gender) if (tens == 2 && hundreds == 0 && groupLevel > 0) { if (number == 2000 || number == 2000000 || number == 2000000000) + { process = AppendedTwos[groupLevel]; + } else + { process = Twos[groupLevel]; + } } else { if (process != string.Empty) + { process += " و "; + } if (tens == 1 && groupLevel > 0 && hundreds == 0) + { process += " "; + } else + { process += gender == GrammaticalGender.Feminine && groupLevel == 0 ? FeminineOnesGroup[tens] : OnesGroup[tens]; + } } } else @@ -74,13 +92,17 @@ public override string Convert(long number, GrammaticalGender gender) if (ones > 0) { if (process != string.Empty) + { process += " و "; + } process += gender == GrammaticalGender.Feminine ? FeminineOnesGroup[ones] : OnesGroup[ones]; } if (process != string.Empty) + { process += " و "; + } process += TensGroup[tens]; } @@ -91,19 +113,27 @@ public override string Convert(long number, GrammaticalGender gender) if (groupLevel > 0) { if (result != string.Empty) + { result = string.Format("{0} {1}", "و", result); + } if (groupNumber != 2) { if (groupNumber % 100 != 1) { if (groupNumber >= 3 && groupNumber <= 10) + { result = string.Format("{0} {1}", PluralGroups[groupLevel], result); + } else + { result = string.Format("{0} {1}", result != string.Empty ? AppendedGroups[groupLevel] : Groups[groupLevel], result); + } } else + { result = string.Format("{0} {1}", Groups[groupLevel], result); + } } } @@ -150,7 +180,11 @@ public override string Convert(long number, GrammaticalGender gender) public override string ConvertToOrdinal(int number, GrammaticalGender gender) { - if (number == 0) return "الصفر"; + if (number == 0) + { + return "الصفر"; + } + var beforeOneHundredNumber = number % 100; var overTensPart = number / 100 * 100; var beforeOneHundredWord = string.Empty; @@ -178,7 +212,9 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) private static string ParseNumber(string word, int number, GrammaticalGender gender) { if (number == 1) + { return gender == GrammaticalGender.Feminine ? "الأولى" : "الأول"; + } if (number <= 10) { @@ -208,7 +244,9 @@ private static string ParseNumber(string word, int number, GrammaticalGender gen } if (number > 19 && newPart == oldPart && oldPart.Length > 1) + { newPart = "ال" + oldPart; + } newParts[count++] = newPart; } @@ -216,7 +254,9 @@ private static string ParseNumber(string word, int number, GrammaticalGender gen word = string.Join(" ", newParts); } else + { word = "ال" + word; + } return word; } diff --git a/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs index d011afdcf..4d144e638 100644 --- a/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BanglaNumberToWordsConverter.cs @@ -49,11 +49,13 @@ internal class BanglaNumberToWordsConverter : GenderlessNumberToWordsConverter {100000, "লক্ষ তম"}, {10000000, "কোটি তম"}, }; - + public override string ConvertToOrdinal(int number) { if (ExceptionNumbersToWords(number, out var exceptionString)) + { return exceptionString; + } return Convert(number) + " তম"; } @@ -67,39 +69,45 @@ public override string Convert(long input) var number = (int)input; if (number == 0) + { return UnitsMap[0]; + } if (number < 0) + { return string.Format("ঋণাত্মক {0}", Convert(-number)); + } var parts = new List(); - if ((number/10000000) > 0) + if ((number / 10000000) > 0) { - parts.Add(string.Format("{0} কোটি", Convert(number/10000000))); + parts.Add(string.Format("{0} কোটি", Convert(number / 10000000))); number %= 10000000; } - if ((number/100000) > 0) + if ((number / 100000) > 0) { - parts.Add(string.Format("{0} লক্ষ", Convert(number/100000))); + parts.Add(string.Format("{0} লক্ষ", Convert(number / 100000))); number %= 100000; } - if ((number/1000) > 0) + if ((number / 1000) > 0) { - parts.Add(string.Format("{0} হাজার", Convert(number/1000))); + parts.Add(string.Format("{0} হাজার", Convert(number / 1000))); number %= 1000; } - if ((number/100) > 0) + if ((number / 100) > 0) { - parts.Add(string.Format("{0}", HundredsMap[number/100])); + parts.Add(string.Format("{0}", HundredsMap[number / 100])); number %= 100; } if (number > 0) + { parts.Add(UnitsMap[number]); + } return string.Join(" ", parts.ToArray()); } diff --git a/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs index 3e9e6f2ef..51d23e65a 100644 --- a/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/BrazilianPortugueseNumberToWordsConverter.cs @@ -22,10 +22,14 @@ public override string Convert(long input, GrammaticalGender gender) var number = (int)input; if (number == 0) + { return "zero"; + } if (number < 0) + { return string.Format("menos {0}", Convert(Math.Abs(number), gender)); + } var parts = new List(); @@ -59,10 +63,14 @@ public override string Convert(long input, GrammaticalGender gender) if ((number / 100) > 0) { if (number == 100) + { parts.Add(parts.Count > 0 ? "e cem" : "cem"); + } else + { // Gender is applied to hundreds starting from 200 parts.Add(ApplyGender(PortugueseHundredsMap[(number / 100)], gender)); + } number %= 100; } @@ -70,15 +78,21 @@ public override string Convert(long input, GrammaticalGender gender) if (number > 0) { if (parts.Count != 0) + { parts.Add("e"); + } if (number < 20) + { parts.Add(ApplyGender(PortugueseUnitsMap[number], gender)); + } else { var lastPart = PortugueseTensMap[number / 10]; if ((number % 10) > 0) + { lastPart += string.Format(" e {0}", ApplyGender(PortugueseUnitsMap[number % 10], gender)); + } parts.Add(lastPart); } @@ -91,7 +105,9 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) { // N/A in Portuguese ordinal if (number == 0) + { return "zero"; + } var parts = new List(); @@ -135,24 +151,34 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) } if (number > 0) + { parts.Add(ApplyOrdinalGender(PortugueseOrdinalUnitsMap[number], gender)); + } return string.Join(" ", parts.ToArray()); } private static string ApplyGender(string toWords, GrammaticalGender gender) { - if (gender != GrammaticalGender.Feminine) + if (gender != GrammaticalGender.Feminine) + { return toWords; + } if (toWords.EndsWith("os")) + { return toWords.Substring(0, toWords.Length - 2) + "as"; + } if (toWords.EndsWith("um")) + { return toWords.Substring(0, toWords.Length - 2) + "uma"; + } if (toWords.EndsWith("dois")) + { return toWords.Substring(0, toWords.Length - 4) + "duas"; + } return toWords; } @@ -160,7 +186,9 @@ private static string ApplyGender(string toWords, GrammaticalGender gender) private static string ApplyOrdinalGender(string toWords, GrammaticalGender gender) { if (gender == GrammaticalGender.Feminine) + { return toWords.TrimEnd('o') + 'a'; + } return toWords; } diff --git a/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs index b2d005f4b..ee3e26c95 100644 --- a/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ChineseNumberToWordsConverter.cs @@ -1,39 +1,45 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace Humanizer.Localisation.NumberToWords { internal class ChineseNumberToWordsConverter : GenderlessNumberToWordsConverter { - private static readonly string[] UnitsMap = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十" }; - + private static readonly string[] UnitsMap = { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十" }; + public override string Convert(long number) { return Convert(number, false, IsSpecial(number)); } - + public override string ConvertToOrdinal(int number) { return Convert(number, true, IsSpecial(number)); } - private bool IsSpecial(long number) => number > 10 && number < 20; + private bool IsSpecial(long number) => number > 10 && number < 20; private string Convert(long number, bool isOrdinal, bool isSpecial) { if (number == 0) + { return UnitsMap[0]; + } if (number < 0) + { return string.Format("负 {0}", Convert(-number, false, false)); + } - var parts = new List(); + var parts = new List(); if ((number / 1000000000000) > 0) { var format = "{0}兆"; if (number % 1000000000000 < 100000000000 && number % 1000000000000 > 0) + { format = "{0}兆零"; + } + parts.Add(string.Format(format, Convert(number / 1000000000000, false, false))); number %= 1000000000000; } @@ -42,16 +48,22 @@ private string Convert(long number, bool isOrdinal, bool isSpecial) { var format = "{0}亿"; if (number % 100000000 < 10000000 && number % 100000000 > 0) + { format = "{0}亿零"; + } + parts.Add(string.Format(format, Convert(number / 100000000, false, false))); number %= 100000000; - } + } if ((number / 10000) > 0) { var format = "{0}万"; if (number % 10000 < 1000 && number % 10000 > 0) + { format = "{0}万零"; + } + parts.Add(string.Format(format, Convert(number / 10000, false, false))); number %= 10000; } @@ -60,7 +72,10 @@ private string Convert(long number, bool isOrdinal, bool isSpecial) { var format = "{0}千"; if (number % 1000 < 100 && number % 1000 > 0) + { format = "{0}千零"; + } + parts.Add(string.Format(format, Convert(number / 1000, false, false))); number %= 1000; } @@ -68,21 +83,28 @@ private string Convert(long number, bool isOrdinal, bool isSpecial) if ((number / 100) > 0) { var format = "{0}百"; - if (number % 100 < 10 && number % 100 > 0) + if (number % 100 < 10 && number % 100 > 0) + { format = "{0}百零"; - parts.Add(string.Format(format, Convert(number / 100, false, false))); + } + + parts.Add(string.Format(format, Convert(number / 100, false, false))); number %= 100; } if (number > 0) - { + { if (number <= 10) + { parts.Add(UnitsMap[number]); + } else { var lastPart = string.Format("{0}十", UnitsMap[number / 10]); if ((number % 10) > 0) - lastPart += string.Format("{0}", UnitsMap[number % 10]); + { + lastPart += string.Format("{0}", UnitsMap[number % 10]); + } parts.Add(lastPart); } @@ -91,12 +113,16 @@ private string Convert(long number, bool isOrdinal, bool isSpecial) var toWords = string.Join("", parts.ToArray()); if (isSpecial) + { toWords = toWords.Substring(1); + } if (isOrdinal) - toWords = string.Format("第 {0}", toWords); + { + toWords = string.Format("第 {0}", toWords); + } return toWords; - } + } } } diff --git a/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs index bfc1978d8..75b89f828 100644 --- a/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/DutchNumberToWordsConverter.cs @@ -15,7 +15,7 @@ internal class DutchNumberToWordsConverter : GenderlessNumberToWordsConverter private static readonly string[] UnitsMap = { "nul", "een", "twee", "drie", "vier", "vijf", "zes", "zeven", "acht", "negen", "tien", "elf", "twaalf", "dertien", "veertien", "vijftien", "zestien", "zeventien", "achttien", "negentien" }; private static readonly string[] TensMap = { "nul", "tien", "twintig", "dertig", "veertig", "vijftig", "zestig", "zeventig", "tachtig", "negentig" }; - class Fact + private class Fact { public int Value { get; set; } public string Name { get; set; } @@ -41,10 +41,14 @@ public override string Convert(long input) var number = (int)input; if (number == 0) + { return UnitsMap[0]; + } if (number < 0) + { return string.Format("min {0}", Convert(-number)); + } var word = ""; @@ -52,23 +56,33 @@ public override string Convert(long input) { var divided = number / m.Value; - if (divided <= 0) + if (divided <= 0) + { continue; + } if (divided == 1 && !m.DisplayOneUnit) + { word += m.Name; + } else + { word += Convert(divided) + m.Prefix + m.Name; + } number %= m.Value; if (number > 0) + { word += m.Postfix; + } } if (number > 0) { if (number < 20) + { word += UnitsMap[number]; + } else { var tens = TensMap[number / 10]; @@ -80,7 +94,9 @@ public override string Convert(long input) word += units + (trema ? "ën" : "en") + tens; } else + { word += tens; + } } } @@ -94,7 +110,7 @@ public override string Convert(long input) {"miljoen", "miljoenste"}, }; - private static readonly char[] EndingCharForSte = {'t', 'g', 'd'}; + private static readonly char[] EndingCharForSte = { 't', 'g', 'd' }; public override string ConvertToOrdinal(int number) { @@ -110,7 +126,9 @@ public override string ConvertToOrdinal(int number) // twintigste, dertigste, veertigste, ... // honderdste, duizendste, ... if (word.LastIndexOfAny(EndingCharForSte) == (word.Length - 1)) + { return word + "ste"; + } return word + "de"; } diff --git a/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs index 4078568d4..0c81b7ae8 100644 --- a/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/EnglishNumberToWordsConverter.cs @@ -33,10 +33,14 @@ public override string ConvertToOrdinal(int number) private string Convert(long number, bool isOrdinal) { if (number == 0) + { return GetUnitValue(0, isOrdinal); + } if (number < 0) + { return string.Format("minus {0}", Convert(-number)); + } var parts = new List(); @@ -85,28 +89,40 @@ private string Convert(long number, bool isOrdinal) if (number > 0) { if (parts.Count != 0) + { parts.Add("and"); + } if (number < 20) + { parts.Add(GetUnitValue(number, isOrdinal)); + } else { var lastPart = TensMap[number / 10]; if ((number % 10) > 0) + { lastPart += string.Format("-{0}", GetUnitValue(number % 10, isOrdinal)); + } else if (isOrdinal) + { lastPart = lastPart.TrimEnd('y') + "ieth"; + } parts.Add(lastPart); } } else if (isOrdinal) + { parts[parts.Count - 1] += "th"; + } var toWords = string.Join(" ", parts.ToArray()); if (isOrdinal) + { toWords = RemoveOnePrefix(toWords); + } return toWords; } @@ -116,19 +132,27 @@ private static string GetUnitValue(long number, bool isOrdinal) if (isOrdinal) { if (ExceptionNumbersToWords(number, out var exceptionString)) + { return exceptionString; + } else + { return UnitsMap[number] + "th"; + } } else + { return UnitsMap[number]; + } } private static string RemoveOnePrefix(string toWords) { // one hundred => hundredth if (toWords.IndexOf("one", StringComparison.Ordinal) == 0) + { toWords = toWords.Remove(0, 4); + } return toWords; } diff --git a/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs index 8f75b6a8c..769f794e6 100644 --- a/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FarsiNumberToWordsConverter.cs @@ -18,13 +18,17 @@ public override string Convert(long input) var number = (int)input; if (number < 0) + { return string.Format("منفی {0}", Convert(-number)); + } if (number == 0) + { return "صفر"; + } - var farsiGroupsMap = new Dictionary> - { + var farsiGroupsMap = new Dictionary> + { {(int)Math.Pow(10, 9), n => string.Format("{0} میلیارد", Convert(n)) }, {(int)Math.Pow(10, 6), n => string.Format("{0} میلیون", Convert(n)) }, {(int)Math.Pow(10, 3), n => string.Format("{0} هزار", Convert(n)) }, @@ -48,7 +52,9 @@ public override string Convert(long input) } if (number > 0) + { parts.Add(FarsiUnitsMap[number]); + } return string.Join(" و ", parts); } @@ -56,13 +62,19 @@ public override string Convert(long input) public override string ConvertToOrdinal(int number) { if (number == 1) + { return "اول"; + } if (number == 3) + { return "سوم"; + } if (number % 10 == 3 && number != 13) + { return Convert((number / 10) * 10) + " و سوم"; + } var word = Convert(number); return string.Format("{0}{1}", word, word.EndsWith("ی") ? " ام" : "م"); diff --git a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs index 657f5fc7c..6d322170f 100644 --- a/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FinnishNumberToWordsConverter.cs @@ -5,8 +5,8 @@ namespace Humanizer.Localisation.NumberToWords { internal class FinnishNumberToWordsConverter : GenderlessNumberToWordsConverter { - private static readonly string[] UnitsMap = { "nolla", "yksi", "kaksi", "kolme", "neljä", "viisi", "kuusi", "seitsemän", "kahdeksan", "yhdeksän", "kymmenen"}; - private static readonly string[] OrdinalUnitsMap = {"nollas", "ensimmäinen", "toinen", "kolmas", "neljäs", "viides", "kuudes", "seitsemäs", "kahdeksas", "yhdeksäs", "kymmenes"}; + private static readonly string[] UnitsMap = { "nolla", "yksi", "kaksi", "kolme", "neljä", "viisi", "kuusi", "seitsemän", "kahdeksan", "yhdeksän", "kymmenen" }; + private static readonly string[] OrdinalUnitsMap = { "nollas", "ensimmäinen", "toinen", "kolmas", "neljäs", "viides", "kuudes", "seitsemäs", "kahdeksas", "yhdeksäs", "kymmenes" }; private static readonly Dictionary OrdinalExceptions = new Dictionary { @@ -23,10 +23,14 @@ public override string Convert(long input) var number = (int)input; if (number < 0) + { return string.Format("miinus {0}", Convert(-number)); + } if (number == 0) + { return UnitsMap[0]; + } var parts = new List(); @@ -72,10 +76,14 @@ public override string Convert(long input) number %= 10; } else if (number > 10 && number < 20) + { parts.Add(string.Format("{0}toista", UnitsMap[number % 10])); + } if (number > 0 && number <= 10) + { parts.Add(UnitsMap[number]); + } return string.Join("", parts).Trim(); } @@ -93,7 +101,9 @@ private string GetOrdinalUnit(int number, bool useExceptions) private string ToOrdinal(int number, bool useExceptions) { if (number == 0) + { return OrdinalUnitsMap[0]; + } var parts = new List(); @@ -127,10 +137,14 @@ private string ToOrdinal(int number, bool useExceptions) number %= 10; } else if (number > 10 && number < 20) + { parts.Add(string.Format("{0}toista", GetOrdinalUnit(number % 10, true))); + } if (number > 0 && number <= 10) + { parts.Add(GetOrdinalUnit(number, useExceptions)); + } return string.Join("", parts); } diff --git a/src/Humanizer/Localisation/NumberToWords/FrenchBelgianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FrenchBelgianNumberToWordsConverter.cs index 674645ea7..25cf63d23 100644 --- a/src/Humanizer/Localisation/NumberToWords/FrenchBelgianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FrenchBelgianNumberToWordsConverter.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; namespace Humanizer.Localisation.NumberToWords { @@ -8,17 +7,25 @@ internal class FrenchBelgianNumberToWordsConverter : FrenchNumberToWordsConverte protected override void CollectPartsUnderAHundred(ICollection parts, ref int number, GrammaticalGender gender, bool pluralize) { if (number == 80) + { parts.Add(pluralize ? "quatre-vingts" : "quatre-vingt"); + } else if (number == 81) + { parts.Add(gender == GrammaticalGender.Feminine ? "quatre-vingt-une" : "quatre-vingt-un"); + } else + { base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize); + } } protected override string GetTens(int tens) { if (tens == 8) + { return "quatre-vingt"; + } return base.GetTens(tens); } diff --git a/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverter.cs index f47c5c10e..45eac1f53 100644 --- a/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverter.cs @@ -2,29 +2,37 @@ namespace Humanizer.Localisation.NumberToWords { - class FrenchNumberToWordsConverter : FrenchNumberToWordsConverterBase + internal class FrenchNumberToWordsConverter : FrenchNumberToWordsConverterBase { protected override void CollectPartsUnderAHundred(ICollection parts, ref int number, GrammaticalGender gender, bool pluralize) { if (number == 71) + { parts.Add("soixante et onze"); + } else if (number == 80) + { parts.Add(pluralize ? "quatre-vingts" : "quatre-vingt"); + } else if (number >= 70) { var @base = number < 80 ? 60 : 80; - int units = number - @base; - var tens = @base/10; + var units = number - @base; + var tens = @base / 10; parts.Add($"{GetTens(tens)}-{GetUnits(units, gender)}"); } else + { base.CollectPartsUnderAHundred(parts, ref number, gender, pluralize); + } } protected override string GetTens(int tens) { if (tens == 8) + { return "quatre-vingt"; + } return base.GetTens(tens); } diff --git a/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverterBase.cs b/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverterBase.cs index 37bcfd4f5..65c0c790a 100644 --- a/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverterBase.cs +++ b/src/Humanizer/Localisation/NumberToWords/FrenchNumberToWordsConverterBase.cs @@ -3,10 +3,10 @@ namespace Humanizer.Localisation.NumberToWords { - abstract class FrenchNumberToWordsConverterBase : GenderedNumberToWordsConverter + internal abstract class FrenchNumberToWordsConverterBase : GenderedNumberToWordsConverter { - static readonly string[] UnitsMap = { "zéro", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf"}; - static readonly string[] TensMap = { "zéro", "dix", "vingt", "trente", "quarante", "cinquante", "soixante", "septante", "octante", "nonante" }; + private static readonly string[] UnitsMap = { "zéro", "un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit", "neuf", "dix", "onze", "douze", "treize", "quatorze", "quinze", "seize", "dix-sept", "dix-huit", "dix-neuf" }; + private static readonly string[] TensMap = { "zéro", "dix", "vingt", "trente", "quarante", "cinquante", "soixante", "septante", "octante", "nonante" }; public override string Convert(long input, GrammaticalGender gender) { @@ -17,7 +17,10 @@ public override string Convert(long input, GrammaticalGender gender) var number = (int)input; if (number == 0) + { return UnitsMap[0]; + } + var parts = new List(); if (number < 0) @@ -38,22 +41,34 @@ public override string Convert(long input, GrammaticalGender gender) public override string ConvertToOrdinal(int number, GrammaticalGender gender) { if (number == 1) + { return gender == GrammaticalGender.Feminine ? "première" : "premier"; + } var convertedNumber = Convert(number); if (convertedNumber.EndsWith("s") && !convertedNumber.EndsWith("trois")) + { convertedNumber = convertedNumber.TrimEnd('s'); + } else if (convertedNumber.EndsWith("cinq")) + { convertedNumber += "u"; + } else if (convertedNumber.EndsWith("neuf")) + { convertedNumber = convertedNumber.TrimEnd('f') + "v"; + } if (convertedNumber.StartsWith("un ")) + { convertedNumber = convertedNumber.Remove(0, 3); + } if (number == 0) + { convertedNumber += "t"; + } convertedNumber = convertedNumber.TrimEnd('e'); convertedNumber += "ième"; @@ -70,11 +85,14 @@ protected static string GetUnits(int number, GrammaticalGender gender) return UnitsMap[number]; } - static void CollectHundreds(ICollection parts, ref int number, int d, string form, bool pluralize) + private static void CollectHundreds(ICollection parts, ref int number, int d, string form, bool pluralize) { - if (number < d) return; + if (number < d) + { + return; + } - var result = number/d; + var result = number / d; if (result == 1) { parts.Add(form); @@ -82,7 +100,7 @@ static void CollectHundreds(ICollection parts, ref int number, int d, st else { parts.Add(GetUnits(result, GrammaticalGender.Masculine)); - if (number%d == 0 && pluralize) + if (number % d == 0 && pluralize) { parts.Add(form + "s"); } @@ -95,11 +113,14 @@ static void CollectHundreds(ICollection parts, ref int number, int d, st number %= d; } - void CollectParts(ICollection parts, ref int number, int d, string form) + private void CollectParts(ICollection parts, ref int number, int d, string form) { - if (number < d) return; + if (number < d) + { + return; + } - var result = number/d; + var result = number / d; CollectPartsUnderAThousand(parts, result, GrammaticalGender.Masculine, true); @@ -115,7 +136,7 @@ void CollectParts(ICollection parts, ref int number, int d, string form) number %= d; } - void CollectPartsUnderAThousand(ICollection parts, int number, GrammaticalGender gender, bool pluralize) + private void CollectPartsUnderAThousand(ICollection parts, int number, GrammaticalGender gender, bool pluralize) { CollectHundreds(parts, ref number, 100, "cent", pluralize); @@ -125,11 +146,14 @@ void CollectPartsUnderAThousand(ICollection parts, int number, Grammatic } } - void CollectThousands(ICollection parts, ref int number, int d, string form) + private void CollectThousands(ICollection parts, ref int number, int d, string form) { - if (number < d) return; + if (number < d) + { + return; + } - var result = number/d; + var result = number / d; if (result > 1) { CollectPartsUnderAThousand(parts, result, GrammaticalGender.Masculine, false); @@ -148,8 +172,8 @@ protected virtual void CollectPartsUnderAHundred(ICollection parts, ref } else { - var units = number%10; - var tens = GetTens(number/10); + var units = number % 10; + var tens = GetTens(number / 10); if (units == 0) { parts.Add(tens); diff --git a/src/Humanizer/Localisation/NumberToWords/FrenchSwissNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/FrenchSwissNumberToWordsConverter.cs index 0ed8a80c2..eaf7dd2bc 100644 --- a/src/Humanizer/Localisation/NumberToWords/FrenchSwissNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/FrenchSwissNumberToWordsConverter.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; - -namespace Humanizer.Localisation.NumberToWords +namespace Humanizer.Localisation.NumberToWords { internal class FrenchSwissNumberToWordsConverter : FrenchNumberToWordsConverterBase { diff --git a/src/Humanizer/Localisation/NumberToWords/GenderedNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/GenderedNumberToWordsConverter.cs index 3bd5d274c..86f1a24cb 100644 --- a/src/Humanizer/Localisation/NumberToWords/GenderedNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/GenderedNumberToWordsConverter.cs @@ -1,6 +1,6 @@ namespace Humanizer.Localisation.NumberToWords { - abstract class GenderedNumberToWordsConverter : INumberToWordsConverter + internal abstract class GenderedNumberToWordsConverter : INumberToWordsConverter { private readonly GrammaticalGender _defaultGender; diff --git a/src/Humanizer/Localisation/NumberToWords/GenderlessNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/GenderlessNumberToWordsConverter.cs index 7e449e133..8f7b1bcfb 100644 --- a/src/Humanizer/Localisation/NumberToWords/GenderlessNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/GenderlessNumberToWordsConverter.cs @@ -1,6 +1,6 @@ namespace Humanizer.Localisation.NumberToWords { - abstract class GenderlessNumberToWordsConverter : INumberToWordsConverter + internal abstract class GenderlessNumberToWordsConverter : INumberToWordsConverter { /// /// Converts the number to string diff --git a/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs b/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs index 88cb69bd0..aef3c062b 100644 --- a/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs +++ b/src/Humanizer/Localisation/NumberToWords/GermanNumberToWordsConverterBase.cs @@ -3,7 +3,7 @@ namespace Humanizer.Localisation.NumberToWords { - abstract class GermanNumberToWordsConverterBase : GenderedNumberToWordsConverter + internal abstract class GermanNumberToWordsConverterBase : GenderedNumberToWordsConverter { private readonly string[] UnitsMap = { "null", "ein", "zwei", "drei", "vier", "fünf", "sechs", "sieben", "acht", "neun", "zehn", "elf", "zwölf", "dreizehn", "vierzehn", "fünfzehn", "sechzehn", "siebzehn", "achtzehn", "neunzehn" }; private readonly string[] TensMap = { "null", "zehn", "zwanzig", "dreißig", "vierzig", "fünfzig", "sechzig", "siebzig", "achtzig", "neunzig" }; @@ -20,7 +20,9 @@ abstract class GermanNumberToWordsConverterBase : GenderedNumberToWordsConverter public override string Convert(long number, GrammaticalGender gender) { if (number == 0) + { return UnitsMap[number]; + } var parts = new List(); if (number < 0) @@ -42,15 +44,21 @@ public override string Convert(long number, GrammaticalGender gender) if (number < 20) { if (number == 1 && gender == GrammaticalGender.Feminine) + { parts.Add("eine"); + } else + { parts.Add(UnitsMap[number]); + } } else { var units = number % 10; if (units > 0) + { parts.Add(string.Format("{0}und", UnitsMap[units])); + } parts.Add(GetTens(number / 10)); } @@ -62,7 +70,9 @@ public override string Convert(long number, GrammaticalGender gender) public override string ConvertToOrdinal(int number, GrammaticalGender gender) { if (number == 0) + { return UnitsMap[number] + GetEndingForGender(gender); + } var parts = new List(); if (number < 0) @@ -77,10 +87,14 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) CollectOrdinalParts(parts, ref number, 100, false, HundredOrdinalPlural, HundredOrdinalSingular); if (number > 0) + { parts.Add(number < 20 ? UnitsOrdinal[number] : Convert(number)); + } if (number == 0 || number >= 20) + { parts.Add("s"); + } parts.Add(GetEndingForGender(gender)); @@ -94,7 +108,9 @@ private void CollectParts(ICollection parts, ref long number, long divis parts.Add(Part(pluralFormat, singular, number / divisor)); number %= divisor; if (addSpaceBeforeNextPart && number > 0) + { parts.Add(" "); + } } } @@ -111,7 +127,10 @@ private void CollectOrdinalParts(ICollection parts, ref int number, int private string Part(string pluralFormat, string singular, long number) { if (number == 1) + { return singular; + } + return string.Format(pluralFormat, Convert(number)); } diff --git a/src/Humanizer/Localisation/NumberToWords/GermanSwissLiechtensteinNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/GermanSwissLiechtensteinNumberToWordsConverter.cs index 20a649865..a4efa7537 100644 --- a/src/Humanizer/Localisation/NumberToWords/GermanSwissLiechtensteinNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/GermanSwissLiechtensteinNumberToWordsConverter.cs @@ -5,7 +5,9 @@ internal class GermanSwissLiechtensteinNumberToWordsConverter : GermanNumberToWo protected override string GetTens(long tens) { if (tens == 3) + { return "dreissig"; + } return base.GetTens(tens); } diff --git a/src/Humanizer/Localisation/NumberToWords/HebrewNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/HebrewNumberToWordsConverter.cs index 91fbcddda..4ef4c1392 100644 --- a/src/Humanizer/Localisation/NumberToWords/HebrewNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/HebrewNumberToWordsConverter.cs @@ -24,12 +24,12 @@ public DescriptionAttribute(string description) private enum Group { - Hundreds = 100, + Hundreds = 100, Thousands = 1000, [Description("מיליון")] - Millions = 1000000, + Millions = 1000000, [Description("מיליארד")] - Billions = 1000000000 + Billions = 1000000000 } public HebrewNumberToWordsConverter(CultureInfo culture) @@ -47,10 +47,14 @@ public override string Convert(long input, GrammaticalGender gender) var number = (int)input; if (number < 0) + { return string.Format("מינוס {0}", Convert(-number, gender)); + } if (number == 0) + { return UnitsFeminine[0]; + } var parts = new List(); if (number >= (int)Group.Billions) @@ -85,7 +89,10 @@ public override string Convert(long input, GrammaticalGender gender) { var unit = gender == GrammaticalGender.Masculine ? UnitsMasculine[number] : UnitsFeminine[number]; if (appendAnd) + { unit = "ו" + unit; + } + parts.Add(unit); } else if (number < 20) @@ -94,14 +101,19 @@ public override string Convert(long input, GrammaticalGender gender) unit = unit.Replace("יי", "י"); unit = string.Format("{0} {1}", unit, gender == GrammaticalGender.Masculine ? "עשר" : "עשרה"); if (appendAnd) + { unit = "ו" + unit; + } + parts.Add(unit); } else { var tenUnit = TensUnit[number / 10 - 1]; if (number % 10 == 0) + { parts.Add(tenUnit); + } else { var unit = Convert(number % 10, gender); @@ -125,9 +137,14 @@ private void ToBigNumber(int number, Group group, List parts) var digits = number / (int)@group; if (digits == 2) + { parts.Add("שני"); + } else if (digits > 2) + { parts.Add(Convert(digits, GrammaticalGender.Masculine)); + } + parts.Add(@group.Humanize()); } @@ -136,13 +153,21 @@ private void ToThousands(int number, List parts) var thousands = number / (int)Group.Thousands; if (thousands == 1) + { parts.Add("אלף"); + } else if (thousands == 2) + { parts.Add("אלפיים"); + } else if (thousands <= 10) + { parts.Add(UnitsFeminine[thousands] + "ת" + " אלפים"); + } else + { parts.Add(Convert(thousands) + " אלף"); + } } private static void ToHundreds(int number, List parts) @@ -153,11 +178,17 @@ private static void ToHundreds(int number, List parts) var hundreds = number / (int)Group.Hundreds; if (hundreds == 1) + { parts.Add("מאה"); + } else if (hundreds == 2) + { parts.Add("מאתיים"); + } else + { parts.Add(UnitsFeminine[hundreds] + " מאות"); + } } } } \ No newline at end of file diff --git a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs index 084edd79f..e9798b7c2 100644 --- a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs +++ b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianCardinalNumberCruncher.cs @@ -3,7 +3,7 @@ namespace Humanizer.Localisation.NumberToWords.Italian { - class ItalianCardinalNumberCruncher + internal class ItalianCardinalNumberCruncher { public ItalianCardinalNumberCruncher(int number, GrammaticalGender gender) { @@ -12,32 +12,34 @@ public ItalianCardinalNumberCruncher(int number, GrammaticalGender gender) _gender = gender; _nextSet = ThreeDigitSets.Units; } - + public string Convert() { // it's easier to treat zero as a completely distinct case if (_fullNumber == 0) + { return "zero"; + } var words = string.Empty; foreach (var part in _threeDigitParts) { var partToString = GetNextPartConverter(); - + words = partToString(part) + words; } - + // remove trailing spaces if there are only millions or billions return words.TrimEnd(); } - + protected readonly int _fullNumber; protected readonly List _threeDigitParts; protected readonly GrammaticalGender _gender; - + protected ThreeDigitSets _nextSet; - + /// /// Splits a number into a sequence of three-digits numbers, starting /// from units, then thousands, millions, and so on. @@ -48,19 +50,19 @@ protected static List SplitEveryThreeDigits(int number) { var parts = new List(); var rest = number; - + while (rest > 0) { var threeDigit = rest % 1000; - + parts.Add(threeDigit); - - rest = (int)(rest / 1000); + + rest = rest / 1000; } - + return parts; } - + /// /// During number conversion to text, finds out the converter to use /// for the next three-digit set. @@ -69,40 +71,40 @@ protected static List SplitEveryThreeDigits(int number) public Func GetNextPartConverter() { Func converter; - + switch (_nextSet) { case ThreeDigitSets.Units: converter = UnitsConverter; _nextSet = ThreeDigitSets.Thousands; break; - + case ThreeDigitSets.Thousands: converter = ThousandsConverter; _nextSet = ThreeDigitSets.Millions; break; - + case ThreeDigitSets.Millions: converter = MillionsConverter; _nextSet = ThreeDigitSets.Billions; break; - + case ThreeDigitSets.Billions: converter = BillionsConverter; _nextSet = ThreeDigitSets.More; break; - + case ThreeDigitSets.More: converter = null; break; - + default: throw new ArgumentOutOfRangeException("Unknow ThreeDigitSet: " + _nextSet); } - + return converter; } - + /// /// Converts a three-digit set to text. /// @@ -111,26 +113,28 @@ public Func GetNextPartConverter() /// The same three-digit set expressed as text. protected static string ThreeDigitSetConverter(int number, bool thisIsLastSet = false) { - if (number == 0) + if (number == 0) + { return string.Empty; - + } + // grab lowest two digits var tensAndUnits = number % 100; // grab third digit - var hundreds = (int)(number / 100); - + var hundreds = number / 100; + // grab also first and second digits separately var units = tensAndUnits % 10; - var tens = (int)(tensAndUnits / 10); - + var tens = tensAndUnits / 10; + var words = string.Empty; - + // append text for hundreds words += _hundredNumberToText[hundreds]; - + // append text for tens, only those from twenty upward words += _tensOver20NumberToText[tens]; - + if (tensAndUnits <= 9) { // simple case for units, under 10 @@ -144,22 +148,22 @@ protected static string ThreeDigitSetConverter(int number, bool thisIsLastSet = else { // just append units text, with some corner cases - + // truncate tens last vowel before 'uno' (1) and 'otto' (8) if (units == 1 || units == 8) { words = words.Remove(words.Length - 1); } - + // if this is the last set, an accent could be due var unitsText = (thisIsLastSet && units == 3 ? "tré" : _unitsNumberToText[units]); - + words += unitsText; } - + return words; } - + /// /// Converts a three-digit number, as units, to text. /// @@ -169,11 +173,13 @@ protected string UnitsConverter(int number) { // being a unique case, it's easier to treat unity feminine gender as a completely distinct case if (_gender == GrammaticalGender.Feminine && _fullNumber == 1) + { return "una"; - + } + return ThreeDigitSetConverter(number, true); } - + /// /// Converts a thousands three-digit number to text. /// @@ -181,15 +187,19 @@ protected string UnitsConverter(int number) /// The same three-digit number of thousands expressed as text. protected static string ThousandsConverter(int number) { - if (number == 0) + if (number == 0) + { return string.Empty; - + } + if (number == 1) + { return "mille"; - + } + return ThreeDigitSetConverter(number) + "mila"; } - + /// /// Converts a millions three-digit number to text. /// @@ -197,15 +207,19 @@ protected static string ThousandsConverter(int number) /// The same three-digit number of millions expressed as text. protected static string MillionsConverter(int number) { - if (number == 0) + if (number == 0) + { return string.Empty; - + } + if (number == 1) + { return "un milione "; - + } + return ThreeDigitSetConverter(number, true) + " milioni "; } - + /// /// Converts a billions three-digit number to text. /// @@ -214,11 +228,13 @@ protected static string MillionsConverter(int number) protected static string BillionsConverter(int number) { if (number == 1) + { return "un miliardo "; - + } + return ThreeDigitSetConverter(number) + " miliardi "; } - + /// /// Lookup table converting units number to text. Index 1 for 1, index 2 for 2, up to index 9. /// @@ -235,7 +251,7 @@ protected static string BillionsConverter(int number) "otto", "nove" }; - + /// /// Lookup table converting tens number to text. Index 2 for 20, index 3 for 30, up to index 9 for 90. /// @@ -252,7 +268,7 @@ protected static string BillionsConverter(int number) "ottanta", "novanta" }; - + /// /// Lookup table converting teens number to text. Index 0 for 10, index 1 for 11, up to index 9 for 19. /// @@ -269,7 +285,7 @@ protected static string BillionsConverter(int number) "diciotto", "diciannove" }; - + /// /// Lookup table converting hundreds number to text. Index 0 for no hundreds, index 1 for 100, up to index 9. /// @@ -286,7 +302,7 @@ protected static string BillionsConverter(int number) "ottocento", "novecento" }; - + /// /// Enumerates sets of three-digits having distinct conversion to text. /// @@ -296,22 +312,22 @@ protected enum ThreeDigitSets /// Lowest three-digits set, from 1 to 999. /// Units, - + /// /// Three-digits set counting the thousands, from 1'000 to 999'000. /// Thousands, - + /// /// Three-digits set counting millions, from 1'000'000 to 999'000'000. /// Millions, - + /// /// Three-digits set counting billions, from 1'000'000'000 to 999'000'000'000. /// Billions, - + /// /// Three-digits set beyond 999 billions, from 1'000'000'000'000 onward. /// diff --git a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs index 69f70aa63..47f13af8d 100644 --- a/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs +++ b/src/Humanizer/Localisation/NumberToWords/Italian/ItalianOrdinalNumberCruncher.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; - -namespace Humanizer.Localisation.NumberToWords.Italian +namespace Humanizer.Localisation.NumberToWords.Italian { - class ItalianOrdinalNumberCruncher + internal class ItalianOrdinalNumberCruncher { public ItalianOrdinalNumberCruncher(int number, GrammaticalGender gender) { @@ -11,12 +8,14 @@ public ItalianOrdinalNumberCruncher(int number, GrammaticalGender gender) _gender = gender; _genderSuffix = (gender == GrammaticalGender.Feminine ? "a" : "o"); } - + public string Convert() { // it's easier to treat zero as a completely distinct case if (_fullNumber == 0) + { return "zero"; + } if (_fullNumber <= 9) { @@ -44,9 +43,13 @@ public string Convert() // reintroduce *unaccented* last vowel in some corner cases if (units == 3) + { words += 'e'; + } else if (units == 6) + { words += 'i'; + } var lowestThreeDigits = _fullNumber % 1000; var lowestSixDigits = _fullNumber % 1000000; diff --git a/src/Humanizer/Localisation/NumberToWords/ItalianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/ItalianNumberToWordsConverter.cs index 67a978e37..e3ac780bc 100644 --- a/src/Humanizer/Localisation/NumberToWords/ItalianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/ItalianNumberToWordsConverter.cs @@ -14,17 +14,19 @@ public override string Convert(long input, GrammaticalGender gender) var number = (int)input; if (number < 0) + { return "meno " + Convert(Math.Abs(number), gender); - + } + var cruncher = new ItalianCardinalNumberCruncher(number, gender); - + return cruncher.Convert(); } public override string ConvertToOrdinal(int number, GrammaticalGender gender) { var cruncher = new ItalianOrdinalNumberCruncher(number, gender); - + return cruncher.Convert(); } } diff --git a/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs index 30b7c3802..baa730059 100644 --- a/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/NorwegianBokmalNumberToWordsConverter.cs @@ -39,10 +39,14 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) private string Convert(int number, bool isOrdinal, GrammaticalGender gender) { if (number == 0) + { return GetUnitValue(0, isOrdinal); + } if (number < 0) + { return string.Format("minus {0}", Convert(-number, isOrdinal, gender)); + } if (number == 1) { @@ -96,26 +100,40 @@ private string Convert(int number, bool isOrdinal, GrammaticalGender gender) if (number > 0) { if (parts.Count != 0) + { if (millionOrMore && !hundred && !thousand) + { parts.Add("og "); + } else + { parts.Add("og"); + } + } if (number < 20) + { parts.Add(GetUnitValue(number, isOrdinal)); + } else { var lastPart = TensMap[number / 10]; if ((number % 10) > 0) + { lastPart += string.Format("{0}", GetUnitValue(number % 10, isOrdinal)); + } else if (isOrdinal) + { lastPart = lastPart.TrimEnd('e') + "ende"; + } parts.Add(lastPart); } } else if (isOrdinal) + { parts[parts.Count - 1] += (number == 0 ? "" : "en") + (millionOrMore ? "te" : "de"); + } var toWords = string.Join("", parts.ToArray()).Trim(); @@ -127,14 +145,22 @@ private static string GetUnitValue(int number, bool isOrdinal) if (isOrdinal) { if (ExceptionNumbersToWords(number, out var exceptionString)) + { return exceptionString; + } else if (number < 13) + { return UnitsMap[number].TrimEnd('e') + "ende"; + } else + { return UnitsMap[number] + "de"; + } } else + { return UnitsMap[number]; + } } private static bool ExceptionNumbersToWords(int number, out string words) @@ -146,7 +172,10 @@ private string Part(string pluralFormat, string singular, int number, bool postf { var postfix = postfixSpace ? " " : ""; if (number == 1) + { return singular + postfix; + } + return string.Format(pluralFormat, Convert(number)) + postfix; } } diff --git a/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs index afa5ce45d..fcb1ad077 100644 --- a/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/PolishNumberToWordsConverter.cs @@ -19,38 +19,46 @@ public PolishNumberToWordsConverter(CultureInfo culture) private static void CollectPartsUnderThousand(ICollection parts, int number) { - var hundreds = number/100; + var hundreds = number / 100; if (hundreds > 0) { parts.Add(HundredsMap[hundreds]); - number = number%100; + number = number % 100; } - var tens = number/10; + var tens = number / 10; if (tens > 1) { parts.Add(TensMap[tens]); - number = number%10; + number = number % 10; } if (number > 0) + { parts.Add(UnitsMap[number]); + } } private static int GetMappingIndex(int number) { if (number == 1) + { return 0; + } if (number > 1 && number < 5) + { return 1; //denominator + } - var tens = number/10; + var tens = number / 10; if (tens > 1) { - var unity = number%10; + var unity = number % 10; if (unity > 1 && unity < 5) + { return 1; //denominator + } } return 2; //genitive @@ -64,7 +72,9 @@ public override string Convert(long input) } var number = (int)input; if (number == 0) + { return "zero"; + } var parts = new List(); @@ -74,42 +84,50 @@ public override string Convert(long input) number = -number; } - var milliard = number/1000000000; + var milliard = number / 1000000000; if (milliard > 0) { if (milliard > 1) + { CollectPartsUnderThousand(parts, milliard); + } var map = new[] { "miliard", "miliardy", "miliardów" }; //one, denominator, genitive parts.Add(map[GetMappingIndex(milliard)]); number %= 1000000000; } - var million = number/1000000; + var million = number / 1000000; if (million > 0) { if (million > 1) + { CollectPartsUnderThousand(parts, million); + } var map = new[] { "milion", "miliony", "milionów" }; //one, denominator, genitive parts.Add(map[GetMappingIndex(million)]); number %= 1000000; } - var thouthand = number/1000; + var thouthand = number / 1000; if (thouthand > 0) { if (thouthand > 1) + { CollectPartsUnderThousand(parts, thouthand); + } var thousand = new[] { "tysiąc", "tysiące", "tysięcy" }; //one, denominator, genitive parts.Add(thousand[GetMappingIndex(thouthand)]); number %= 1000; } - var units = number/1; + var units = number / 1; if (units > 0) + { CollectPartsUnderThousand(parts, units); + } return string.Join(" ", parts); } diff --git a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs index 6dbd4dc6d..f30e9b640 100644 --- a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianCardinalNumberConverter.cs @@ -3,8 +3,7 @@ namespace Humanizer.Localisation.NumberToWords.Romanian { - - class RomanianCardinalNumberConverter + internal class RomanianCardinalNumberConverter { /// @@ -151,7 +150,7 @@ private List SplitEveryThreeDigits(int number) parts.Add(threeDigit); - rest = (int)(rest / 1000); + rest = rest / 1000; } return parts; @@ -205,16 +204,18 @@ private Func GetNextPartConverter(ThreeDigitSets private string ThreeDigitSetConverter(int number, GrammaticalGender gender, bool thisIsLastSet = false) { if (number == 0) + { return string.Empty; + } // grab lowest two digits var tensAndUnits = number % 100; // grab third digit - var hundreds = (int)(number / 100); + var hundreds = number / 100; // grab also first and second digits separately var units = tensAndUnits % 10; - var tens = (int)(tensAndUnits / 10); + var tens = tensAndUnits / 10; var words = string.Empty; @@ -222,7 +223,7 @@ private string ThreeDigitSetConverter(int number, GrammaticalGender gender, bool words += HundredsToText(hundreds); // append text for tens, only those from twenty upward - words += ((tens >= 2) ? " " : string.Empty) + _tensOver20NumberToText[tens]; + words += ((tens >= 2) ? " " : string.Empty) + _tensOver20NumberToText[tens]; if (tensAndUnits <= 9) { @@ -251,15 +252,23 @@ private string getPartByGender(string multiGenderPart, GrammaticalGender gender) { var parts = multiGenderPart.Split('|'); if (gender == GrammaticalGender.Feminine) + { return parts[1]; + } + if (gender == GrammaticalGender.Neuter) + { return parts[2]; - + } else + { return parts[0]; + } } else + { return multiGenderPart; + } } private bool IsAbove20(int number) @@ -270,13 +279,17 @@ private bool IsAbove20(int number) private string HundredsToText(int hundreds) { if (hundreds == 0) + { return string.Empty; - + } else if (hundreds == 1) + { return _feminineSingular + " sută"; - + } else + { return getPartByGender(_units[hundreds], GrammaticalGender.Feminine) + " sute"; + } } /// @@ -300,13 +313,17 @@ private string UnitsConverter(int number, GrammaticalGender gender) private string ThousandsConverter(int number, GrammaticalGender gender) { if (number == 0) + { return string.Empty; - + } else if (number == 1) + { return _feminineSingular + " mie"; - + } else + { return ThreeDigitSetConverter(number, GrammaticalGender.Feminine) + (IsAbove20(number) ? " " + _joinAbove20 : string.Empty) + " mii"; + } } // Large numbers (above 10^6) use a combined form of the long and short scales. @@ -330,13 +347,17 @@ trilion trilioane 10^12 short private string MillionsConverter(int number, GrammaticalGender gender) { if (number == 0) + { return string.Empty; - + } else if (number == 1) + { return _masculineSingular + " milion"; - + } else + { return ThreeDigitSetConverter(number, GrammaticalGender.Feminine, true) + (IsAbove20(number) ? " " + _joinAbove20 : string.Empty) + " milioane"; + } } /// @@ -348,9 +369,13 @@ private string MillionsConverter(int number, GrammaticalGender gender) private string BillionsConverter(int number, GrammaticalGender gender) { if (number == 1) + { return _masculineSingular + " miliard"; + } else + { return ThreeDigitSetConverter(number, GrammaticalGender.Feminine) + (IsAbove20(number) ? " " + _joinAbove20 : string.Empty) + " miliarde"; + } } } } diff --git a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs index 6d2f29239..345df22de 100644 --- a/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/Romanian/RomanianOrdinalNumberConverter.cs @@ -2,7 +2,7 @@ namespace Humanizer.Localisation.NumberToWords.Romanian { - class RomanianOrdinalNumberConverter + internal class RomanianOrdinalNumberConverter { /// /// Lookup table converting units number to text. Index 1 for 1, index 2 for 2, up to index 9. @@ -29,16 +29,22 @@ public string Convert(int number, GrammaticalGender gender) { // it's easier to treat zero as a completely distinct case if (number == 0) + { return "zero"; + } else if (number == 1) + { // no prefixes for primul/prima return this.getPartByGender(_ordinalsUnder10[number], gender); + } else if (number <= 9) + { // units ordinals, 2 to 9, are totally different than the rest: treat them as a distinct case return string.Format("{0} {1}", gender == GrammaticalGender.Feminine ? _femininePrefix : _masculinePrefix, this.getPartByGender(_ordinalsUnder10[number], gender) ); + } else { var coverter = new RomanianCardinalNumberConverter(); @@ -64,22 +70,29 @@ public string Convert(int number, GrammaticalGender gender) if (words.EndsWith("milioane")) { if (gender == GrammaticalGender.Feminine) + { words = words.Substring(0, words.Length - 8) + "milioana"; + } } var customMasculineSuffix = _masculineSuffix; if (words.EndsWith("milion")) { if (gender == GrammaticalGender.Feminine) + { words = words.Substring(0, words.Length - 6) + "milioana"; - + } else + { customMasculineSuffix = "u" + _masculineSuffix; + } } else if (words.EndsWith("miliard")) { if (gender == GrammaticalGender.Masculine) + { customMasculineSuffix = "u" + _masculineSuffix; + } } // trim last letter @@ -106,13 +119,18 @@ private string getPartByGender(string multiGenderPart, GrammaticalGender gender) { var parts = multiGenderPart.Split('|'); if (gender == GrammaticalGender.Feminine) + { return parts[1]; - + } else + { return parts[0]; + } } else + { return multiGenderPart; + } } } } diff --git a/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs index a446a0843..1eeeb5948 100644 --- a/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/RussianNumberToWordsConverter.cs @@ -22,7 +22,9 @@ public override string Convert(long input, GrammaticalGender gender) } var number = (int)input; if (number == 0) + { return "ноль"; + } var parts = new List(); @@ -37,7 +39,9 @@ public override string Convert(long input, GrammaticalGender gender) CollectParts(parts, ref number, 1000, GrammaticalGender.Feminine, "тысяча", "тысячи", "тысяч"); if (number > 0) + { CollectPartsUnderOneThousand(parts, number, gender); + } return string.Join(" ", parts); } @@ -45,7 +49,9 @@ public override string Convert(long input, GrammaticalGender gender) public override string ConvertToOrdinal(int number, GrammaticalGender gender) { if (number == 0) + { return "нулев" + GetEndingForGender(gender, number); + } var parts = new List(); @@ -62,27 +68,37 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) if (number >= 100) { var ending = GetEndingForGender(gender, number); - var hundreds = number/100; + var hundreds = number / 100; number %= 100; if (number == 0) + { parts.Add(UnitsOrdinalPrefixes[hundreds] + "сот" + ending); + } else + { parts.Add(HundredsMap[hundreds]); + } } if (number >= 20) { var ending = GetEndingForGender(gender, number); - var tens = number/10; + var tens = number / 10; number %= 10; if (number == 0) + { parts.Add(TensOrdinal[tens] + ending); + } else + { parts.Add(TensMap[tens]); + } } if (number > 0) + { parts.Add(UnitsOrdinal[number] + GetEndingForGender(gender, number)); + } return string.Join(" ", parts); } @@ -91,14 +107,14 @@ private static void CollectPartsUnderOneThousand(ICollection parts, int { if (number >= 100) { - var hundreds = number/100; + var hundreds = number / 100; number %= 100; parts.Add(HundredsMap[hundreds]); } if (number >= 20) { - var tens = number/10; + var tens = number / 10; parts.Add(TensMap[tens]); number %= 10; } @@ -106,13 +122,21 @@ private static void CollectPartsUnderOneThousand(ICollection parts, int if (number > 0) { if (number == 1 && gender == GrammaticalGender.Feminine) + { parts.Add("одна"); + } else if (number == 1 && gender == GrammaticalGender.Neuter) + { parts.Add("одно"); + } else if (number == 2 && gender == GrammaticalGender.Feminine) + { parts.Add("две"); + } else if (number < 20) + { parts.Add(UnitsMap[number]); + } } } @@ -122,17 +146,21 @@ private static string GetPrefix(int number) if (number >= 100) { - var hundreds = number/100; + var hundreds = number / 100; number %= 100; if (hundreds != 1) + { parts.Add(UnitsOrdinalPrefixes[hundreds] + "сот"); + } else + { parts.Add("сто"); + } } if (number >= 20) { - var tens = number/10; + var tens = number / 10; number %= 10; parts.Add(TensOrdinalPrefixes[tens]); } @@ -147,8 +175,12 @@ private static string GetPrefix(int number) private static void CollectParts(ICollection parts, ref int number, int divisor, GrammaticalGender gender, params string[] forms) { - if (number < divisor) return; - var result = number/divisor; + if (number < divisor) + { + return; + } + + var result = number / divisor; number %= divisor; CollectPartsUnderOneThousand(parts, result, gender); @@ -157,15 +189,23 @@ private static void CollectParts(ICollection parts, ref int number, int private static void CollectOrdinalParts(ICollection parts, ref int number, int divisor, GrammaticalGender gender, string prefixedForm, params string[] forms) { - if (number < divisor) return; - var result = number/divisor; + if (number < divisor) + { + return; + } + + var result = number / divisor; number %= divisor; if (number == 0) { if (result == 1) + { parts.Add(prefixedForm); + } else + { parts.Add(GetPrefix(result) + prefixedForm); + } } else { @@ -177,10 +217,14 @@ private static void CollectOrdinalParts(ICollection parts, ref int numbe private static int GetIndex(RussianGrammaticalNumber number) { if (number == RussianGrammaticalNumber.Singular) + { return 0; + } if (number == RussianGrammaticalNumber.Paucal) + { return 1; + } return 2; } @@ -196,17 +240,29 @@ private static string GetEndingForGender(GrammaticalGender gender, int number) { case GrammaticalGender.Masculine: if (number == 0 || number == 2 || number == 6 || number == 7 || number == 8 || number == 40) + { return "ой"; + } + if (number == 3) + { return "ий"; + } + return "ый"; case GrammaticalGender.Feminine: if (number == 3) + { return "ья"; + } + return "ая"; case GrammaticalGender.Neuter: if (number == 3) + { return "ье"; + } + return "ое"; default: throw new ArgumentOutOfRangeException(nameof(gender)); diff --git a/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs index 1691f690b..f1f1a3c06 100644 --- a/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SerbianCyrlNumberToWordsConverter.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; namespace Humanizer.Localisation.NumberToWords { @@ -27,10 +25,14 @@ public override string Convert(long input) var number = (int)input; if (number == 0) + { return "нула"; + } if (number < 0) + { return string.Format("- {0}", Convert(-number)); + } var parts = new List(); var billions = number / 1000000000; @@ -41,7 +43,9 @@ public override string Convert(long input) number %= 1000000000; if (number > 0) + { parts.Add(" "); + } } var millions = number / 1000000; @@ -52,7 +56,9 @@ public override string Convert(long input) number %= 1000000; if (number > 0) + { parts.Add(" "); + } } var thousands = number / 1000; @@ -63,7 +69,9 @@ public override string Convert(long input) number %= 1000; if (number > 0) + { parts.Add(" "); + } } var hundreds = number / 100; @@ -74,13 +82,17 @@ public override string Convert(long input) number %= 100; if (number > 0) + { parts.Add(" "); + } } if (number > 0) { if (number < 20) + { parts.Add(UnitsMap[number]); + } else { parts.Add(TensMap[number / 10]); @@ -88,7 +100,9 @@ public override string Convert(long input) var units = number % 10; if (units > 0) + { parts.Add(string.Format(" {0}", UnitsMap[units])); + } } } diff --git a/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs index a3eabd47c..95b988395 100644 --- a/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SerbianNumberToWordsConverter.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; namespace Humanizer.Localisation.NumberToWords { @@ -26,10 +24,14 @@ public override string Convert(long input) } var number = (int)input; if (number == 0) + { return "nula"; + } if (number < 0) + { return string.Format("- {0}", Convert(-number)); + } var parts = new List(); var billions = number / 1000000000; @@ -40,7 +42,9 @@ public override string Convert(long input) number %= 1000000000; if (number > 0) + { parts.Add(" "); + } } var millions = number / 1000000; @@ -51,7 +55,9 @@ public override string Convert(long input) number %= 1000000; if (number > 0) + { parts.Add(" "); + } } var thousands = number / 1000; @@ -62,7 +68,9 @@ public override string Convert(long input) number %= 1000; if (number > 0) + { parts.Add(" "); + } } var hundreds = number / 100; @@ -73,20 +81,26 @@ public override string Convert(long input) number %= 100; if (number > 0) + { parts.Add(" "); + } } if (number > 0) { if (number < 20) + { parts.Add(UnitsMap[number]); + } else { parts.Add(TensMap[number / 10]); var units = number % 10; if (units > 0) + { parts.Add(string.Format(" {0}", UnitsMap[units])); + } } } diff --git a/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs index 99f400761..8fe8fdddf 100644 --- a/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SlovenianNumberToWordsConverter.cs @@ -6,8 +6,8 @@ namespace Humanizer.Localisation.NumberToWords { internal class SlovenianNumberToWordsConverter : GenderlessNumberToWordsConverter { - private static readonly string[] UnitsMap = {"nič", "ena", "dva", "tri", "štiri", "pet", "šest", "sedem", "osem", "devet", "deset", "enajst", "dvanajst", "trinajst", "štirinajst", "petnajst", "šestnajst", "sedemnajst", "osemnajst", "devetnajst"}; - private static readonly string[] TensMap = {"nič", "deset", "dvajset", "trideset", "štirideset", "petdeset", "šestdeset", "sedemdeset", "osemdeset", "devetdeset"}; + private static readonly string[] UnitsMap = { "nič", "ena", "dva", "tri", "štiri", "pet", "šest", "sedem", "osem", "devet", "deset", "enajst", "dvanajst", "trinajst", "štirinajst", "petnajst", "šestnajst", "sedemnajst", "osemnajst", "devetnajst" }; + private static readonly string[] TensMap = { "nič", "deset", "dvajset", "trideset", "štirideset", "petdeset", "šestdeset", "sedemdeset", "osemdeset", "devetdeset" }; private readonly CultureInfo _culture; @@ -24,70 +24,88 @@ public override string Convert(long input) } var number = (int)input; if (number == 0) - return "nič"; + { + return "nič"; + } - if (number < 0) - return string.Format("minus {0}", Convert(-number)); + if (number < 0) + { + return string.Format("minus {0}", Convert(-number)); + } - var parts = new List(); + var parts = new List(); - var billions = number / 1000000000; - if (billions > 0) - { - parts.Add(Part("milijarda", "dve milijardi", "{0} milijarde", "{0} milijard", billions)); - number %= 1000000000; - if (number > 0) - parts.Add(" "); - } - - var millions = number / 1000000; - if (millions > 0) - { - parts.Add(Part("milijon", "dva milijona", "{0} milijone", "{0} milijonov", millions)); - number %= 1000000; - if (number > 0) - parts.Add(" "); - } - - var thousands = number / 1000; - if (thousands > 0) - { - parts.Add(Part("tisoč", "dva tisoč", "{0} tisoč", "{0} tisoč", thousands)); - number %= 1000; - if (number > 0) - parts.Add(" "); - } - - var hundreds = number / 100; - if (hundreds > 0) - { - parts.Add(Part("sto", "dvesto", "{0}sto", "{0}sto", hundreds)); - number %= 100; - if (number > 0) - parts.Add(" "); - } + var billions = number / 1000000000; + if (billions > 0) + { + parts.Add(Part("milijarda", "dve milijardi", "{0} milijarde", "{0} milijard", billions)); + number %= 1000000000; + if (number > 0) + { + parts.Add(" "); + } + } + + var millions = number / 1000000; + if (millions > 0) + { + parts.Add(Part("milijon", "dva milijona", "{0} milijone", "{0} milijonov", millions)); + number %= 1000000; + if (number > 0) + { + parts.Add(" "); + } + } - if (number > 0) - { - if (number < 20) + var thousands = number / 1000; + if (thousands > 0) { - if (number > 1) - parts.Add(UnitsMap[number]); - else - parts.Add("ena"); + parts.Add(Part("tisoč", "dva tisoč", "{0} tisoč", "{0} tisoč", thousands)); + number %= 1000; + if (number > 0) + { + parts.Add(" "); + } } - else + + var hundreds = number / 100; + if (hundreds > 0) { - var units = number % 10; - if (units > 0) - parts.Add(string.Format("{0}in", UnitsMap[units])); + parts.Add(Part("sto", "dvesto", "{0}sto", "{0}sto", hundreds)); + number %= 100; + if (number > 0) + { + parts.Add(" "); + } + } - parts.Add(TensMap[number / 10]); + if (number > 0) + { + if (number < 20) + { + if (number > 1) + { + parts.Add(UnitsMap[number]); + } + else + { + parts.Add("ena"); + } + } + else + { + var units = number % 10; + if (units > 0) + { + parts.Add(string.Format("{0}in", UnitsMap[units])); + } + + parts.Add(TensMap[number / 10]); + } } - } - return string.Join("", parts); - } + return string.Join("", parts); + } public override string ConvertToOrdinal(int number) { @@ -95,17 +113,23 @@ public override string ConvertToOrdinal(int number) } private string Part(string singular, string dual, string trialQuadral, string plural, int number) - { - if (number == 1) - return singular; + { + if (number == 1) + { + return singular; + } - if (number == 2) - return dual; + if (number == 2) + { + return dual; + } - if (number == 3 || number == 4) - return string.Format(trialQuadral, Convert(number)); + if (number == 3 || number == 4) + { + return string.Format(trialQuadral, Convert(number)); + } - return string.Format(plural, Convert(number)); - } + return string.Format(plural, Convert(number)); + } } } \ No newline at end of file diff --git a/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs index 339754e76..1950619d2 100644 --- a/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/SpanishNumberToWordsConverter.cs @@ -5,7 +5,7 @@ namespace Humanizer.Localisation.NumberToWords { internal class SpanishNumberToWordsConverter : GenderedNumberToWordsConverter { - private static readonly string[] UnitsMap = { "cero", "uno", "dos", "tres", "cuatro", "cinco", "seis", "siete", "ocho", "nueve", "diez", "once", "doce", + private static readonly string[] UnitsMap = { "cero", "uno", "dos", "tres", "cuatro", "cinco", "seis", "siete", "ocho", "nueve", "diez", "once", "doce", "trece", "catorce", "quince", "dieciséis", "diecisiete", "dieciocho", "diecinueve", "veinte", "veintiuno", "veintidós", "veintitrés", "veinticuatro", "veinticinco", "veintiséis", "veintisiete", "veintiocho", "veintinueve"}; private const string Feminine1 = "una"; @@ -37,10 +37,14 @@ public override string Convert(long input, GrammaticalGender gender) } var number = (int)input; if (number == 0) + { return "cero"; + } if (number < 0) + { return string.Format("menos {0}", Convert(Math.Abs(number))); + } var parts = new List(); @@ -73,9 +77,9 @@ public override string Convert(long input, GrammaticalGender gender) if ((number / 100) > 0) { - parts.Add(number == 100 + parts.Add(number == 100 ? "cien" - : gender == GrammaticalGender.Feminine + : gender == GrammaticalGender.Feminine ? FeminineHundredsMap[(number / 100)] : HundredsMap[(number / 100)]); number %= 100; @@ -96,8 +100,8 @@ public override string Convert(long input, GrammaticalGender gender) } else { - var lastPart = TensMap[number/10]; - int units = number%10; + var lastPart = TensMap[number / 10]; + var units = number % 10; if (units == 1 && gender == GrammaticalGender.Feminine) { lastPart += " y una"; @@ -124,15 +128,23 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) } if (number < 0) + { return string.Format("menos {0}", Convert(Math.Abs(number))); + } if (number == 0) + { return string.Format("cero"); + } if ((number / 1000) > 0) { var thousandsPart = ThousandsMapOrdinal[(number / 1000)]; - if (gender == GrammaticalGender.Feminine) thousandsPart = thousandsPart.TrimEnd('o') + "a"; + if (gender == GrammaticalGender.Feminine) + { + thousandsPart = thousandsPart.TrimEnd('o') + "a"; + } + parts.Add(thousandsPart); number %= 1000; } @@ -140,7 +152,11 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) if ((number / 100) > 0) { var hundredsPart = HundredsMapOrdinal[(number / 100)]; - if (gender == GrammaticalGender.Feminine) hundredsPart = hundredsPart.TrimEnd('o') + "a"; + if (gender == GrammaticalGender.Feminine) + { + hundredsPart = hundredsPart.TrimEnd('o') + "a"; + } + parts.Add(hundredsPart); number %= 100; } @@ -148,14 +164,22 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) if ((number / 10) > 0) { var tensPart = TensMapOrdinal[(number / 10)]; - if (gender == GrammaticalGender.Feminine) tensPart = tensPart.TrimEnd('o') + "a"; + if (gender == GrammaticalGender.Feminine) + { + tensPart = tensPart.TrimEnd('o') + "a"; + } + parts.Add(tensPart); number %= 10; } if (Ordinals.TryGetValue(number, out var towords)) { - if (gender == GrammaticalGender.Feminine) towords = towords.TrimEnd('o') + "a"; + if (gender == GrammaticalGender.Feminine) + { + towords = towords.TrimEnd('o') + "a"; + } + parts.Add(towords); } diff --git a/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs index bf80a1754..908cb92bd 100644 --- a/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/TurkishNumberToWordConverter.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; namespace Humanizer.Localisation.NumberToWords { @@ -30,10 +28,14 @@ public override string Convert(long input) } var number = (int)input; if (number == 0) + { return UnitsMap[0]; + } if (number < 0) + { return string.Format("eksi {0}", Convert(-number)); + } var parts = new List(); @@ -95,10 +97,14 @@ public override string ConvertToOrdinal(int number) } if (word[word.Length - 1] == 't') + { word = word.Substring(0, word.Length - 1) + 'd'; + } if (suffixFoundOnLastVowel) + { word = word.Substring(0, word.Length - 1); + } return string.Format("{0}{1}", word, wordSuffix); } diff --git a/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs b/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs index c05fe9407..0ae298f0c 100644 --- a/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UkrainianNumberToWordsConverter.cs @@ -22,7 +22,9 @@ public override string Convert(long input, GrammaticalGender gender) } var number = (int)input; if (number == 0) + { return "нуль"; + } var parts = new List(); @@ -37,7 +39,9 @@ public override string Convert(long input, GrammaticalGender gender) CollectParts(parts, ref number, 1000, GrammaticalGender.Feminine, "тисяча", "тисячі", "тисяч"); if (number > 0) + { CollectPartsUnderOneThousand(parts, number, gender); + } return string.Join(" ", parts); } @@ -45,7 +49,9 @@ public override string Convert(long input, GrammaticalGender gender) public override string ConvertToOrdinal(int number, GrammaticalGender gender) { if (number == 0) + { return "нульов" + GetEndingForGender(gender, number); + } var parts = new List(); @@ -62,27 +68,37 @@ public override string ConvertToOrdinal(int number, GrammaticalGender gender) if (number >= 100) { var ending = GetEndingForGender(gender, number); - var hundreds = number/100; + var hundreds = number / 100; number %= 100; if (number == 0) + { parts.Add(UnitsOrdinalPrefixes[hundreds] + "сот" + ending); + } else + { parts.Add(HundredsMap[hundreds]); + } } if (number >= 20) { var ending = GetEndingForGender(gender, number); - var tens = number/10; + var tens = number / 10; number %= 10; if (number == 0) + { parts.Add(TensOrdinal[tens] + ending); + } else + { parts.Add(TensMap[tens]); + } } if (number > 0) + { parts.Add(UnitsOrdinal[number] + GetEndingForGender(gender, number)); + } return string.Join(" ", parts); } @@ -91,14 +107,14 @@ private static void CollectPartsUnderOneThousand(ICollection parts, int { if (number >= 100) { - var hundreds = number/100; + var hundreds = number / 100; number %= 100; parts.Add(HundredsMap[hundreds]); } if (number >= 20) { - var tens = number/10; + var tens = number / 10; parts.Add(TensMap[tens]); number %= 10; } @@ -106,13 +122,21 @@ private static void CollectPartsUnderOneThousand(ICollection parts, int if (number > 0) { if (number == 1 && gender == GrammaticalGender.Feminine) + { parts.Add("одна"); + } else if (number == 1 && gender == GrammaticalGender.Neuter) + { parts.Add("одне"); + } else if (number == 2 && gender == GrammaticalGender.Feminine) + { parts.Add("дві"); + } else if (number < 20) + { parts.Add(UnitsMap[number]); + } } } @@ -122,17 +146,21 @@ private static string GetPrefix(int number) if (number >= 100) { - var hundreds = number/100; + var hundreds = number / 100; number %= 100; if (hundreds != 1) + { parts.Add(UnitsOrdinalPrefixes[hundreds] + "сот"); + } else + { parts.Add("сто"); + } } if (number >= 20) { - var tens = number/10; + var tens = number / 10; number %= 10; parts.Add(TensOrdinalPrefixes[tens]); } @@ -147,8 +175,12 @@ private static string GetPrefix(int number) private static void CollectParts(ICollection parts, ref int number, int divisor, GrammaticalGender gender, params string[] forms) { - if (number < divisor) return; - var result = number/divisor; + if (number < divisor) + { + return; + } + + var result = number / divisor; number %= divisor; CollectPartsUnderOneThousand(parts, result, gender); @@ -157,15 +189,23 @@ private static void CollectParts(ICollection parts, ref int number, int private static void CollectOrdinalParts(ICollection parts, ref int number, int divisor, GrammaticalGender gender, string prefixedForm, params string[] forms) { - if (number < divisor) return; - var result = number/divisor; + if (number < divisor) + { + return; + } + + var result = number / divisor; number %= divisor; if (number == 0) { if (result == 1) + { parts.Add(prefixedForm); + } else + { parts.Add(GetPrefix(result) + prefixedForm); + } } else { @@ -177,10 +217,14 @@ private static void CollectOrdinalParts(ICollection parts, ref int numbe private static int GetIndex(RussianGrammaticalNumber number) { if (number == RussianGrammaticalNumber.Singular) + { return 0; + } if (number == RussianGrammaticalNumber.Paucal) + { return 1; + } return 2; } @@ -196,15 +240,24 @@ private static string GetEndingForGender(GrammaticalGender gender, int number) { case GrammaticalGender.Masculine: if (number == 3) + { return "ій"; + } + return "ий"; case GrammaticalGender.Feminine: if (number == 3) + { return "я"; + } + return "а"; case GrammaticalGender.Neuter: if (number == 3) + { return "є"; + } + return "е"; default: throw new ArgumentOutOfRangeException(nameof(gender)); diff --git a/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs index bb9374109..c0873c6b0 100644 --- a/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UzbekCyrlNumberToWordConverter.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text; namespace Humanizer.Localisation.NumberToWords @@ -20,17 +18,24 @@ public override string Convert(long input) } var number = (int)input; if (number < 0) + { return string.Format("минус {0}", Convert(-number, true)); + } + return Convert(number, true); } private string Convert(int number, bool checkForHoundredRule) { if (number == 0) + { return UnitsMap[0]; + } if (checkForHoundredRule && number == 100) + { return "юз"; + } var sb = new StringBuilder(); @@ -79,11 +84,15 @@ public override string ConvertToOrdinal(int number) var word = Convert(number); var i = 0; if (string.IsNullOrEmpty(word)) + { return string.Empty; + } var lastChar = word[word.Length - 1]; if (lastChar == 'и' || lastChar == 'а') + { i = 1; + } return string.Format("{0}{1}", word, OrdinalSuffixes[i]); } diff --git a/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs b/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs index da54f2ffe..117cfcc50 100644 --- a/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs +++ b/src/Humanizer/Localisation/NumberToWords/UzbekLatnNumberToWordConverter.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Text; namespace Humanizer.Localisation.NumberToWords @@ -20,17 +18,24 @@ public override string Convert(long input) } var number = (int)input; if (number < 0) + { return string.Format("minus {0}", Convert(-number, true)); + } + return Convert(number, true); } private string Convert(int number, bool checkForHoundredRule) { if (number == 0) + { return UnitsMap[0]; + } if (checkForHoundredRule && number == 100) + { return "yuz"; + } var sb = new StringBuilder(); @@ -79,11 +84,15 @@ public override string ConvertToOrdinal(int number) var word = Convert(number); var i = 0; if (string.IsNullOrEmpty(word)) + { return string.Empty; + } var lastChar = word[word.Length - 1]; if (lastChar == 'i' || lastChar == 'a') + { i = 1; + } return string.Format("{0}{1}", word, OrdinalSuffixes[i]); } diff --git a/src/Humanizer/Localisation/Ordinalizers/DutchOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/DutchOrdinalizer.cs index 92c548205..a25f977ed 100644 --- a/src/Humanizer/Localisation/Ordinalizers/DutchOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/DutchOrdinalizer.cs @@ -11,7 +11,9 @@ public override string Convert(int number, string numberString, GrammaticalGende { // N/A in Dutch if (number == 0) + { return "0"; + } return numberString + "e"; } diff --git a/src/Humanizer/Localisation/Ordinalizers/EnglishOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/EnglishOrdinalizer.cs index 6ed8fb950..efe30247d 100644 --- a/src/Humanizer/Localisation/Ordinalizers/EnglishOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/EnglishOrdinalizer.cs @@ -7,7 +7,9 @@ public override string Convert(int number, string numberString) var nMod100 = number % 100; if (nMod100 >= 11 && nMod100 <= 13) + { return numberString + "th"; + } switch (number % 10) { diff --git a/src/Humanizer/Localisation/Ordinalizers/ItalianOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/ItalianOrdinalizer.cs index 3681ff273..60a149318 100644 --- a/src/Humanizer/Localisation/Ordinalizers/ItalianOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/ItalianOrdinalizer.cs @@ -11,10 +11,14 @@ public override string Convert(int number, string numberString, GrammaticalGende { // No ordinal for 0 in italian (neologism apart) if (number == 0) + { return "0"; + } if (gender == GrammaticalGender.Feminine) + { return numberString + "ª"; + } return numberString + "°"; } diff --git a/src/Humanizer/Localisation/Ordinalizers/PortugueseOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/PortugueseOrdinalizer.cs index 31f1ab335..8b35b69d9 100644 --- a/src/Humanizer/Localisation/Ordinalizers/PortugueseOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/PortugueseOrdinalizer.cs @@ -11,10 +11,14 @@ public override string Convert(int number, string numberString, GrammaticalGende { // N/A in Portuguese if (number == 0) + { return "0"; + } if (gender == GrammaticalGender.Feminine) + { return numberString + "ª"; + } return numberString + "º"; } diff --git a/src/Humanizer/Localisation/Ordinalizers/RomanianOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/RomanianOrdinalizer.cs index e619e0c86..989ba1902 100644 --- a/src/Humanizer/Localisation/Ordinalizers/RomanianOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/RomanianOrdinalizer.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; - -namespace Humanizer.Localisation.Ordinalizers +namespace Humanizer.Localisation.Ordinalizers { internal class RomanianOrdinalizer : DefaultOrdinalizer diff --git a/src/Humanizer/Localisation/Ordinalizers/RussianOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/RussianOrdinalizer.cs index f7ae4b004..691825545 100644 --- a/src/Humanizer/Localisation/Ordinalizers/RussianOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/RussianOrdinalizer.cs @@ -10,10 +10,14 @@ public override string Convert(int number, string numberString) public override string Convert(int number, string numberString, GrammaticalGender gender) { if (gender == GrammaticalGender.Masculine) + { return numberString + "-й"; - + } + if (gender == GrammaticalGender.Feminine) + { return numberString + "-я"; + } return numberString + "-е"; } diff --git a/src/Humanizer/Localisation/Ordinalizers/SpanishOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/SpanishOrdinalizer.cs index d34a8fbe7..c2a187f47 100644 --- a/src/Humanizer/Localisation/Ordinalizers/SpanishOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/SpanishOrdinalizer.cs @@ -11,12 +11,18 @@ public override string Convert(int number, string numberString, GrammaticalGende { // N/A in Spanish if (number == 0) + { return "0"; + } if (gender == GrammaticalGender.Feminine) - return numberString + ".ª"; + { + return numberString + ".ª"; + } else + { return numberString + ".º"; + } } } } \ No newline at end of file diff --git a/src/Humanizer/Localisation/Ordinalizers/TurkishOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/TurkishOrdinalizer.cs index 1448fb36b..16c995be0 100644 --- a/src/Humanizer/Localisation/Ordinalizers/TurkishOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/TurkishOrdinalizer.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Humanizer.Localisation.Ordinalizers +namespace Humanizer.Localisation.Ordinalizers { internal class TurkishOrdinalizer : DefaultOrdinalizer { diff --git a/src/Humanizer/Localisation/Ordinalizers/UkrainianOrdinalizer.cs b/src/Humanizer/Localisation/Ordinalizers/UkrainianOrdinalizer.cs index 64990ea9c..bb7d8b89b 100644 --- a/src/Humanizer/Localisation/Ordinalizers/UkrainianOrdinalizer.cs +++ b/src/Humanizer/Localisation/Ordinalizers/UkrainianOrdinalizer.cs @@ -11,18 +11,27 @@ public override string Convert(int number, string numberString, GrammaticalGende { if (gender == GrammaticalGender.Masculine) + { return numberString + "-й"; + } if (gender == GrammaticalGender.Feminine) { if (number % 10 == 3) + { return numberString + "-я"; + } + return numberString + "-а"; } if (gender == GrammaticalGender.Neuter) + { if (number % 10 == 3) + { return numberString + "-є"; + } + } return numberString + "-е"; } diff --git a/src/Humanizer/Localisation/ResourceKeys.Common.cs b/src/Humanizer/Localisation/ResourceKeys.Common.cs index 427ce03f1..a8643cc06 100644 --- a/src/Humanizer/Localisation/ResourceKeys.Common.cs +++ b/src/Humanizer/Localisation/ResourceKeys.Common.cs @@ -12,8 +12,10 @@ public partial class ResourceKeys private static void ValidateRange(int count) { - if (count < 0) + if (count < 0) + { throw new ArgumentOutOfRangeException(nameof(count)); + } } } } diff --git a/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs b/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs index 827169f55..89a3a50ff 100644 --- a/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs +++ b/src/Humanizer/Localisation/ResourceKeys.DateHumanize.cs @@ -37,8 +37,10 @@ public static string GetResourceKey(TimeUnit timeUnit, Tense timeUnitTense, int { ValidateRange(count); - if (count == 0) + if (count == 0) + { return Now; + } var singularity = count == 1 ? Single : Multiple; var tense = timeUnitTense == Tense.Future ? FromNow : Ago; diff --git a/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs b/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs index 321e961a3..ba16d1bba 100644 --- a/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs +++ b/src/Humanizer/Localisation/ResourceKeys.TimeSpanHumanize.cs @@ -24,8 +24,10 @@ public static string GetResourceKey(TimeUnit unit, int count = 1) { ValidateRange(count); - if (count == 0) + if (count == 0) + { return Zero; + } return TimeSpanFormat.FormatWith(count == 1 ? Single : Multiple, unit, count == 1 ? "" : "s"); } diff --git a/src/Humanizer/Localisation/Resources.cs b/src/Humanizer/Localisation/Resources.cs index bd723b3f4..3943f3e5b 100644 --- a/src/Humanizer/Localisation/Resources.cs +++ b/src/Humanizer/Localisation/Resources.cs @@ -9,7 +9,7 @@ namespace Humanizer.Localisation /// public static class Resources { - static readonly ResourceManager ResourceManager = new ResourceManager("Humanizer.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly); + private static readonly ResourceManager ResourceManager = new ResourceManager("Humanizer.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly); /// /// Returns the value of the specified string resource diff --git a/src/Humanizer/MetricNumeralExtensions.cs b/src/Humanizer/MetricNumeralExtensions.cs index 90b0981b5..5ce9a3e2d 100644 --- a/src/Humanizer/MetricNumeralExtensions.cs +++ b/src/Humanizer/MetricNumeralExtensions.cs @@ -27,68 +27,68 @@ namespace Humanizer { - /// - /// Contains extension methods for changing a number to Metric representation (ToMetric) - /// and from Metric representation back to the number (FromMetric) - /// - public static class MetricNumeralExtensions - { - static readonly double BigLimit; - static readonly double SmallLimit; + /// + /// Contains extension methods for changing a number to Metric representation (ToMetric) + /// and from Metric representation back to the number (FromMetric) + /// + public static class MetricNumeralExtensions + { + private static readonly double BigLimit; + private static readonly double SmallLimit; - static MetricNumeralExtensions() - { + static MetricNumeralExtensions() + { const int limit = 27; BigLimit = Math.Pow(10, limit); SmallLimit = Math.Pow(10, -limit); } - /// - /// Symbols is a list of every symbols for the Metric system. - /// - private static readonly List[] Symbols = + /// + /// Symbols is a list of every symbols for the Metric system. + /// + private static readonly List[] Symbols = { new List { 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' }, new List { 'm', 'μ', 'n', 'p', 'f', 'a', 'z', 'y' } }; - /// - /// Names link a Metric symbol (as key) to its name (as value). - /// - /// - /// We dont support : - /// {'h', "hecto"}, - /// {'da', "deca" }, // !string - /// {'d', "deci" }, - /// {'c', "centi"}, - /// - private static readonly Dictionary Names = new Dictionary + /// + /// Names link a Metric symbol (as key) to its name (as value). + /// + /// + /// We dont support : + /// {'h', "hecto"}, + /// {'da', "deca" }, // !string + /// {'d', "deci" }, + /// {'c', "centi"}, + /// + private static readonly Dictionary Names = new Dictionary { {'Y', "yotta" }, {'Z', "zetta" }, {'E', "exa" }, {'P', "peta" }, {'T', "tera" }, {'G', "giga" }, {'M', "mega" }, {'k', "kilo" }, {'m', "milli" }, {'μ', "micro" }, {'n', "nano" }, {'p', "pico" }, {'f', "femto" }, {'a', "atto" }, {'z', "zepto" }, {'y', "yocto" } }; - /// - /// Converts a Metric representation into a number. - /// - /// - /// We don't support input in the format {number}{name} nor {number} {name}. - /// We only provide a solution for {number}{symbol} and {number} {symbol}. - /// - /// Metric representation to convert to a number - /// - /// - /// "1k".FromMetric() => 1000d - /// "123".FromMetric() => 123d - /// "100m".FromMetric() => 1E-1 - /// - /// - /// A number after a conversion from a Metric representation. - public static double FromMetric(this string input) - { - input = CleanRepresentation(input); - return BuildNumber(input, input[input.Length - 1]); - } + /// + /// Converts a Metric representation into a number. + /// + /// + /// We don't support input in the format {number}{name} nor {number} {name}. + /// We only provide a solution for {number}{symbol} and {number} {symbol}. + /// + /// Metric representation to convert to a number + /// + /// + /// "1k".FromMetric() => 1000d + /// "123".FromMetric() => 123d + /// "100m".FromMetric() => 1E-1 + /// + /// + /// A number after a conversion from a Metric representation. + public static double FromMetric(this string input) + { + input = CleanRepresentation(input); + return BuildNumber(input, input[input.Length - 1]); + } /// /// Converts a number into a valid and Human-readable Metric representation. @@ -110,9 +110,9 @@ public static double FromMetric(this string input) /// /// A valid Metric representation public static string ToMetric(this int input, bool hasSpace = false, bool useSymbol = true, int? decimals = null) - { - return ((double)input).ToMetric(hasSpace, useSymbol, decimals); - } + { + return ((double)input).ToMetric(hasSpace, useSymbol, decimals); + } /// /// Converts a number into a valid and Human-readable Metric representation. @@ -134,72 +134,81 @@ public static string ToMetric(this int input, bool hasSpace = false, bool useSym /// /// A valid Metric representation public static string ToMetric(this double input, bool hasSpace = false, bool useSymbol = true, int? decimals = null) - { - if (input.Equals(0)) - return input.ToString(); - if (input.IsOutOfRange()) - throw new ArgumentOutOfRangeException(nameof(input)); + { + if (input.Equals(0)) + { + return input.ToString(); + } - return BuildRepresentation(input, hasSpace, useSymbol, decimals); - } + if (input.IsOutOfRange()) + { + throw new ArgumentOutOfRangeException(nameof(input)); + } - /// - /// Clean or handle any wrong input - /// - /// Metric representation to clean - /// A cleaned representation - private static string CleanRepresentation(string input) - { - if (input == null) - throw new ArgumentNullException(nameof(input)); + return BuildRepresentation(input, hasSpace, useSymbol, decimals); + } - input = input.Trim(); - input = ReplaceNameBySymbol(input); - if (input.Length == 0 || input.IsInvalidMetricNumeral()) - throw new ArgumentException("Empty or invalid Metric string.", nameof(input)); + /// + /// Clean or handle any wrong input + /// + /// Metric representation to clean + /// A cleaned representation + private static string CleanRepresentation(string input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } - return input.Replace(" ", string.Empty); - } + input = input.Trim(); + input = ReplaceNameBySymbol(input); + if (input.Length == 0 || input.IsInvalidMetricNumeral()) + { + throw new ArgumentException("Empty or invalid Metric string.", nameof(input)); + } - /// - /// Build a number from a metric representation or from a number - /// - /// A Metric representation to parse to a number - /// The last character of input - /// A number build from a Metric representation - private static double BuildNumber(string input, char last) - { - return char.IsLetter(last) - ? BuildMetricNumber(input, last) - : double.Parse(input); - } + return input.Replace(" ", string.Empty); + } - /// - /// Build a number from a metric representation - /// - /// A Metric representation to parse to a number - /// The last character of input - /// A number build from a Metric representation - private static double BuildMetricNumber(string input, char last) - { + /// + /// Build a number from a metric representation or from a number + /// + /// A Metric representation to parse to a number + /// The last character of input + /// A number build from a Metric representation + private static double BuildNumber(string input, char last) + { + return char.IsLetter(last) + ? BuildMetricNumber(input, last) + : double.Parse(input); + } + + /// + /// Build a number from a metric representation + /// + /// A Metric representation to parse to a number + /// The last character of input + /// A number build from a Metric representation + private static double BuildMetricNumber(string input, char last) + { double getExponent(List symbols) => (symbols.IndexOf(last) + 1) * 3; var number = double.Parse(input.Remove(input.Length - 1)); var exponent = Math.Pow(10, Symbols[0].Contains(last) - ? getExponent(Symbols[0]) - : -getExponent(Symbols[1])); - return number * exponent; - } + ? getExponent(Symbols[0]) + : -getExponent(Symbols[1])); + return number * exponent; + } - /// - /// Replace every symbol's name by its symbol representation. - /// - /// Metric representation with a name or a symbol - /// A metric representation with a symbol - private static string ReplaceNameBySymbol(string input) - { - return Names.Aggregate(input, (current, name) => - current.Replace(name.Value, name.Key.ToString())); - } + /// + /// Replace every symbol's name by its symbol representation. + /// + /// Metric representation with a name or a symbol + /// A metric representation with a symbol + private static string ReplaceNameBySymbol(string input) + { + return Names.Aggregate(input, (current, name) => + current.Replace(name.Value, name.Key.ToString())); + } /// /// Build a Metric representation of the number. @@ -210,75 +219,78 @@ private static string ReplaceNameBySymbol(string input) /// If not null it is the numbers of decimals to round the number to /// A number in a Metric representation private static string BuildRepresentation(double input, bool hasSpace, bool useSymbol, int? decimals) - { - var exponent = (int)Math.Floor(Math.Log10(Math.Abs(input)) / 3); + { + var exponent = (int)Math.Floor(Math.Log10(Math.Abs(input)) / 3); return exponent.Equals(0) - ? input.ToString() - : BuildMetricRepresentation(input, exponent, hasSpace, useSymbol, decimals); - } + ? input.ToString() + : BuildMetricRepresentation(input, exponent, hasSpace, useSymbol, decimals); + } - /// - /// Build a Metric representation of the number. - /// - /// Number to convert to a Metric representation. - /// Exponent of the number in a scientific notation - /// True will split the number and the symbol with a whitespace. - /// True will use symbol instead of name + /// + /// Build a Metric representation of the number. + /// + /// Number to convert to a Metric representation. + /// Exponent of the number in a scientific notation + /// True will split the number and the symbol with a whitespace. + /// True will use symbol instead of name /// If not null it is the numbers of decimals to round the number to - /// A number in a Metric representation - private static string BuildMetricRepresentation(double input, int exponent, bool hasSpace, bool useSymbol, int? decimals) - { - var number = input * Math.Pow(1000, -exponent); + /// A number in a Metric representation + private static string BuildMetricRepresentation(double input, int exponent, bool hasSpace, bool useSymbol, int? decimals) + { + var number = input * Math.Pow(1000, -exponent); if (decimals.HasValue) + { number = Math.Round(number, decimals.Value); - var symbol = Math.Sign(exponent) == 1 - ? Symbols[0][exponent - 1] - : Symbols[1][-exponent - 1]; - return number - + (hasSpace ? " " : string.Empty) - + GetUnit(symbol, useSymbol); - } + } + + var symbol = Math.Sign(exponent) == 1 + ? Symbols[0][exponent - 1] + : Symbols[1][-exponent - 1]; + return number + + (hasSpace ? " " : string.Empty) + + GetUnit(symbol, useSymbol); + } - /// - /// Get the unit from a symbol of from the symbol's name. - /// - /// The symbol linked to the unit - /// True will use symbol instead of name - /// A symbol or a symbol's name - private static string GetUnit(char symbol, bool useSymbol) - { - return useSymbol ? symbol.ToString() : Names[symbol]; - } + /// + /// Get the unit from a symbol of from the symbol's name. + /// + /// The symbol linked to the unit + /// True will use symbol instead of name + /// A symbol or a symbol's name + private static string GetUnit(char symbol, bool useSymbol) + { + return useSymbol ? symbol.ToString() : Names[symbol]; + } - /// - /// Check if a Metric representation is out of the valid range. - /// - /// A Metric representation who might be out of the valid range. - /// True if input is out of the valid range. - private static bool IsOutOfRange(this double input) - { + /// + /// Check if a Metric representation is out of the valid range. + /// + /// A Metric representation who might be out of the valid range. + /// True if input is out of the valid range. + private static bool IsOutOfRange(this double input) + { bool outside(double min, double max) => !(max > input && input > min); return (Math.Sign(input) == 1 && outside(SmallLimit, BigLimit)) - || (Math.Sign(input) == -1 && outside(-BigLimit, -SmallLimit)); - } + || (Math.Sign(input) == -1 && outside(-BigLimit, -SmallLimit)); + } - /// - /// Check if a string is not a valid Metric representation. - /// A valid representation is in the format "{0}{1}" or "{0} {1}" - /// where {0} is a number and {1} is an allowed symbol. - /// - /// - /// ToDo: Performance: Use (string input, out number) to escape the double use of Parse() - /// - /// A string who might contain a invalid Metric representation. - /// True if input is not a valid Metric representation. - private static bool IsInvalidMetricNumeral(this string input) - { - var index = input.Length - 1; - var last = input[index]; - var isSymbol = Symbols[0].Contains(last) || Symbols[1].Contains(last); - return !double.TryParse(isSymbol ? input.Remove(index) : input, out var number); - } - } + /// + /// Check if a string is not a valid Metric representation. + /// A valid representation is in the format "{0}{1}" or "{0} {1}" + /// where {0} is a number and {1} is an allowed symbol. + /// + /// + /// ToDo: Performance: Use (string input, out number) to escape the double use of Parse() + /// + /// A string who might contain a invalid Metric representation. + /// True if input is not a valid Metric representation. + private static bool IsInvalidMetricNumeral(this string input) + { + var index = input.Length - 1; + var last = input[index]; + var isSymbol = Symbols[0].Contains(last) || Symbols[1].Contains(last); + return !double.TryParse(isSymbol ? input.Remove(index) : input, out var number); + } + } } diff --git a/src/Humanizer/NumberToNumberExtensions.cs b/src/Humanizer/NumberToNumberExtensions.cs index a81b0aaa3..e1e99a35d 100644 --- a/src/Humanizer/NumberToNumberExtensions.cs +++ b/src/Humanizer/NumberToNumberExtensions.cs @@ -13,7 +13,7 @@ public static class NumberToNumberExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Tens(this int input) { - return input*10; + return input * 10; } /// @@ -22,7 +22,7 @@ public static int Tens(this int input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint Tens(this uint input) { - return input*10; + return input * 10; } /// @@ -31,7 +31,7 @@ public static uint Tens(this uint input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long Tens(this long input) { - return input*10; + return input * 10; } /// @@ -40,7 +40,7 @@ public static long Tens(this long input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong Tens(this ulong input) { - return input*10; + return input * 10; } /// @@ -49,7 +49,7 @@ public static ulong Tens(this ulong input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double Tens(this double input) { - return input*10; + return input * 10; } /// @@ -58,7 +58,7 @@ public static double Tens(this double input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Hundreds(this int input) { - return input*100; + return input * 100; } /// @@ -67,7 +67,7 @@ public static int Hundreds(this int input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint Hundreds(this uint input) { - return input*100; + return input * 100; } /// @@ -76,7 +76,7 @@ public static uint Hundreds(this uint input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long Hundreds(this long input) { - return input*100; + return input * 100; } /// @@ -85,7 +85,7 @@ public static long Hundreds(this long input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong Hundreds(this ulong input) { - return input*100; + return input * 100; } /// @@ -94,7 +94,7 @@ public static ulong Hundreds(this ulong input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double Hundreds(this double input) { - return input*100; + return input * 100; } /// @@ -103,7 +103,7 @@ public static double Hundreds(this double input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Thousands(this int input) { - return input*1000; + return input * 1000; } /// @@ -112,7 +112,7 @@ public static int Thousands(this int input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint Thousands(this uint input) { - return input*1000; + return input * 1000; } /// @@ -121,7 +121,7 @@ public static uint Thousands(this uint input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long Thousands(this long input) { - return input*1000; + return input * 1000; } /// @@ -130,7 +130,7 @@ public static long Thousands(this long input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong Thousands(this ulong input) { - return input*1000; + return input * 1000; } /// @@ -139,7 +139,7 @@ public static ulong Thousands(this ulong input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double Thousands(this double input) { - return input*1000; + return input * 1000; } /// @@ -148,7 +148,7 @@ public static double Thousands(this double input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Millions(this int input) { - return input*1000000; + return input * 1000000; } /// @@ -157,7 +157,7 @@ public static int Millions(this int input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint Millions(this uint input) { - return input*1000000; + return input * 1000000; } /// @@ -166,7 +166,7 @@ public static uint Millions(this uint input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long Millions(this long input) { - return input*1000000; + return input * 1000000; } /// @@ -175,7 +175,7 @@ public static long Millions(this long input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong Millions(this ulong input) { - return input*1000000; + return input * 1000000; } /// @@ -184,7 +184,7 @@ public static ulong Millions(this ulong input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double Millions(this double input) { - return input*1000000; + return input * 1000000; } /// @@ -193,7 +193,7 @@ public static double Millions(this double input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Billions(this int input) { - return input*1000000000; + return input * 1000000000; } /// @@ -202,7 +202,7 @@ public static int Billions(this int input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint Billions(this uint input) { - return input*1000000000; + return input * 1000000000; } /// @@ -211,7 +211,7 @@ public static uint Billions(this uint input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long Billions(this long input) { - return input*1000000000; + return input * 1000000000; } /// @@ -220,7 +220,7 @@ public static long Billions(this long input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong Billions(this ulong input) { - return input*1000000000; + return input * 1000000000; } /// @@ -229,7 +229,7 @@ public static ulong Billions(this ulong input) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static double Billions(this double input) { - return input*1000000000; + return input * 1000000000; } } } diff --git a/src/Humanizer/NumberToTimeSpanExtensions.cs b/src/Humanizer/NumberToTimeSpanExtensions.cs index 1cbdee3f0..b0b288bf6 100644 --- a/src/Humanizer/NumberToTimeSpanExtensions.cs +++ b/src/Humanizer/NumberToTimeSpanExtensions.cs @@ -54,7 +54,7 @@ public static TimeSpan Milliseconds(this ushort ms) /// public static TimeSpan Milliseconds(this int ms) { - return Milliseconds((double) ms); + return Milliseconds((double)ms); } /// @@ -64,7 +64,7 @@ public static TimeSpan Milliseconds(this int ms) /// public static TimeSpan Milliseconds(this uint ms) { - return Milliseconds((double) ms); + return Milliseconds((double)ms); } /// @@ -74,7 +74,7 @@ public static TimeSpan Milliseconds(this uint ms) /// public static TimeSpan Milliseconds(this long ms) { - return Milliseconds((double) ms); + return Milliseconds((double)ms); } /// @@ -144,7 +144,7 @@ public static TimeSpan Seconds(this ushort seconds) /// public static TimeSpan Seconds(this int seconds) { - return Seconds((double) seconds); + return Seconds((double)seconds); } /// @@ -154,7 +154,7 @@ public static TimeSpan Seconds(this int seconds) /// public static TimeSpan Seconds(this uint seconds) { - return Seconds((double) seconds); + return Seconds((double)seconds); } /// @@ -164,7 +164,7 @@ public static TimeSpan Seconds(this uint seconds) /// public static TimeSpan Seconds(this long seconds) { - return Seconds((double) seconds); + return Seconds((double)seconds); } /// @@ -234,7 +234,7 @@ public static TimeSpan Minutes(this ushort minutes) /// public static TimeSpan Minutes(this int minutes) { - return Minutes((double) minutes); + return Minutes((double)minutes); } /// @@ -244,7 +244,7 @@ public static TimeSpan Minutes(this int minutes) /// public static TimeSpan Minutes(this uint minutes) { - return Minutes((double) minutes); + return Minutes((double)minutes); } /// @@ -254,7 +254,7 @@ public static TimeSpan Minutes(this uint minutes) /// public static TimeSpan Minutes(this long minutes) { - return Minutes((double) minutes); + return Minutes((double)minutes); } /// @@ -324,7 +324,7 @@ public static TimeSpan Hours(this ushort hours) /// public static TimeSpan Hours(this int hours) { - return Hours((double) hours); + return Hours((double)hours); } /// @@ -334,7 +334,7 @@ public static TimeSpan Hours(this int hours) /// public static TimeSpan Hours(this uint hours) { - return Hours((double) hours); + return Hours((double)hours); } /// @@ -344,7 +344,7 @@ public static TimeSpan Hours(this uint hours) /// public static TimeSpan Hours(this long hours) { - return Hours((double) hours); + return Hours((double)hours); } /// @@ -414,7 +414,7 @@ public static TimeSpan Days(this ushort days) /// public static TimeSpan Days(this int days) { - return Days((double) days); + return Days((double)days); } /// @@ -424,7 +424,7 @@ public static TimeSpan Days(this int days) /// public static TimeSpan Days(this uint days) { - return Days((double) days); + return Days((double)days); } /// @@ -434,7 +434,7 @@ public static TimeSpan Days(this uint days) /// public static TimeSpan Days(this long days) { - return Days((double) days); + return Days((double)days); } /// @@ -504,7 +504,7 @@ public static TimeSpan Weeks(this ushort input) /// public static TimeSpan Weeks(this int input) { - return Weeks((double) input); + return Weeks((double)input); } /// @@ -514,7 +514,7 @@ public static TimeSpan Weeks(this int input) /// public static TimeSpan Weeks(this uint input) { - return Weeks((double) input); + return Weeks((double)input); } /// @@ -524,9 +524,9 @@ public static TimeSpan Weeks(this uint input) /// public static TimeSpan Weeks(this long input) { - return Weeks((double) input); + return Weeks((double)input); } - + /// /// 2.Weeks() == new TimeSpan(14, 0, 0, 0) /// @@ -544,7 +544,7 @@ public static TimeSpan Weeks(this ulong input) /// public static TimeSpan Weeks(this double input) { - return Days(7*input); + return Days(7 * input); } } } \ No newline at end of file diff --git a/src/Humanizer/Properties/AssemblyInfo.cs b/src/Humanizer/Properties/AssemblyInfo.cs index 73718e711..149d621c4 100644 --- a/src/Humanizer/Properties/AssemblyInfo.cs +++ b/src/Humanizer/Properties/AssemblyInfo.cs @@ -1,5 +1,3 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.InteropServices; +using System.Resources; [assembly: NeutralResourcesLanguage("en")] \ No newline at end of file diff --git a/src/Humanizer/RomanNumeralExtensions.cs b/src/Humanizer/RomanNumeralExtensions.cs index 1dc3aac19..c391a243b 100644 --- a/src/Humanizer/RomanNumeralExtensions.cs +++ b/src/Humanizer/RomanNumeralExtensions.cs @@ -31,7 +31,7 @@ public static class RomanNumeralExtensions { "I", 1 } }; - private static readonly Regex ValidRomanNumeral = + private static readonly Regex ValidRomanNumeral = new Regex( "^(?i:(?=[MDCLXVI])((M{0,3})((C[DM])|(D?C{0,3}))?((X[LC])|(L?XX{0,2})|L)?((I[VX])|(V?(II{0,2}))|V)?))$", RegexOptionsUtil.Compiled); @@ -44,17 +44,21 @@ public static class RomanNumeralExtensions public static int FromRoman(this string input) { if (input == null) + { throw new ArgumentNullException(nameof(input)); + } input = input.Trim().ToUpperInvariant(); var length = input.Length; if ((length == 0) || IsInvalidRomanNumeral(input)) + { throw new ArgumentException("Empty or invalid Roman numeral string.", nameof(input)); + } var total = 0; - var i = length; + var i = length; while (i > 0) { @@ -84,12 +88,14 @@ public static int FromRoman(this string input) /// Roman number public static string ToRoman(this int input) { - const int minValue = 1; - const int maxValue = 3999; + const int minValue = 1; + const int maxValue = 3999; const int maxRomanNumeralLength = 15; if ((input < minValue) || (input > maxValue)) + { throw new ArgumentOutOfRangeException(); + } var sb = new StringBuilder(maxRomanNumeralLength); diff --git a/src/Humanizer/StringHumanizeExtensions.cs b/src/Humanizer/StringHumanizeExtensions.cs index b4fe36273..c25a6a8cd 100644 --- a/src/Humanizer/StringHumanizeExtensions.cs +++ b/src/Humanizer/StringHumanizeExtensions.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq; +using System.Linq; using System.Text.RegularExpressions; namespace Humanizer @@ -19,12 +18,12 @@ static StringHumanizeExtensions() FreestandingSpacingCharRegex = new Regex(@"\s[-_]|[-_]\s", RegexOptionsUtil.Compiled); } - static string FromUnderscoreDashSeparatedWords (string input) + private static string FromUnderscoreDashSeparatedWords(string input) { - return string.Join(" ", input.Split(new[] {'_', '-'})); + return string.Join(" ", input.Split(new[] { '_', '-' })); } - static string FromPascalCase(string input) + private static string FromPascalCase(string input) { var result = string.Join(" ", PascalCaseWordPartsRegex .Matches(input).Cast() @@ -46,15 +45,21 @@ public static string Humanize(this string input) { // if input is all capitals (e.g. an acronym) then return it without change if (input.ToCharArray().All(char.IsUpper)) + { return input; + } // if input contains a dash or underscore which preceeds or follows a space (or both, e.g. free-standing) // remove the dash/underscore and run it through FromPascalCase if (FreestandingSpacingCharRegex.IsMatch(input)) + { return FromPascalCase(FromUnderscoreDashSeparatedWords(input)); + } if (input.Contains("_") || input.Contains("-")) + { return FromUnderscoreDashSeparatedWords(input); + } return FromPascalCase(input); } diff --git a/src/Humanizer/TimeSpanHumanizeExtensions.cs b/src/Humanizer/TimeSpanHumanizeExtensions.cs index 89a8d3958..bb4fb2ee0 100644 --- a/src/Humanizer/TimeSpanHumanizeExtensions.cs +++ b/src/Humanizer/TimeSpanHumanizeExtensions.cs @@ -122,18 +122,18 @@ private static int GetSpecialCaseMonthAsInteger(TimeSpan timespan, bool isTimeUn { if (isTimeUnitToGetTheMaximumTimeUnit) { - return (int)((double)timespan.Days / _daysInAMonth); + return (int)(timespan.Days / _daysInAMonth); } else { - var remainingDays = (double)timespan.Days % _daysInAYear; + var remainingDays = timespan.Days % _daysInAYear; return (int)(remainingDays / _daysInAMonth); } } private static int GetSpecialCaseYearAsInteger(TimeSpan timespan) { - return (int)((double)timespan.Days / _daysInAYear); + return (int)(timespan.Days / _daysInAYear); } private static int GetSpecialCaseWeeksAsInteger(TimeSpan timespan, bool isTimeUnitToGetTheMaximumTimeUnit) @@ -156,7 +156,7 @@ private static int GetSpecialCaseDaysAsInteger(TimeSpan timespan, bool isTimeUni var remainingDays = timespan.Days % _daysInAWeek; return remainingDays; } - return (int)((double)timespan.Days % _daysInAMonth); + return (int)(timespan.Days % _daysInAMonth); } private static int GetNormalCaseTimeAsInteger(int timeNumberOfUnits, double totalTimeNumberOfUnits, bool isTimeUnitToGetTheMaximumTimeUnit) @@ -197,10 +197,15 @@ private static bool IsContainingOnlyNullValue(IEnumerable timeParts) private static IEnumerable SetPrecisionOfTimeSpan(IEnumerable timeParts, int precision, bool countEmptyUnits) { if (!countEmptyUnits) + { timeParts = timeParts.Where(x => x != null); + } + timeParts = timeParts.Take(precision); if (countEmptyUnits) + { timeParts = timeParts.Where(x => x != null); + } return timeParts; } diff --git a/src/Humanizer/ToQuantityExtensions.cs b/src/Humanizer/ToQuantityExtensions.cs index 021a62e4a..90ad2cc77 100644 --- a/src/Humanizer/ToQuantityExtensions.cs +++ b/src/Humanizer/ToQuantityExtensions.cs @@ -111,12 +111,15 @@ private static string ToQuantity(this string input, long quantity, ShowQuantityA : input.Pluralize(inputIsKnownToBeSingular: false); if (showQuantityAs == ShowQuantityAs.None) + { return transformedInput; + } if (showQuantityAs == ShowQuantityAs.Numeric) + { return string.Format(formatProvider, "{0} {1}", quantity.ToString(format, formatProvider), transformedInput); + } - return string.Format("{0} {1}", quantity.ToWords(), transformedInput); } } diff --git a/src/Humanizer/Transformer/ToLowerCase.cs b/src/Humanizer/Transformer/ToLowerCase.cs index 1e4b7163b..c6ba8043f 100644 --- a/src/Humanizer/Transformer/ToLowerCase.cs +++ b/src/Humanizer/Transformer/ToLowerCase.cs @@ -2,7 +2,7 @@ namespace Humanizer { - class ToLowerCase : IStringTransformer + internal class ToLowerCase : IStringTransformer { public string Transform(string input) { diff --git a/src/Humanizer/Transformer/ToSentenceCase.cs b/src/Humanizer/Transformer/ToSentenceCase.cs index 4af3452c0..1794a518d 100644 --- a/src/Humanizer/Transformer/ToSentenceCase.cs +++ b/src/Humanizer/Transformer/ToSentenceCase.cs @@ -1,13 +1,13 @@ -using System; - namespace Humanizer { - class ToSentenceCase : IStringTransformer + internal class ToSentenceCase : IStringTransformer { public string Transform(string input) { if (input.Length >= 1) + { return string.Concat(input.Substring(0, 1).ToUpper(), input.Substring(1)); + } return input.ToUpper(); } diff --git a/src/Humanizer/Transformer/ToTitleCase.cs b/src/Humanizer/Transformer/ToTitleCase.cs index 50bdff3e3..6954b8456 100644 --- a/src/Humanizer/Transformer/ToTitleCase.cs +++ b/src/Humanizer/Transformer/ToTitleCase.cs @@ -1,10 +1,9 @@ -using System; using System.Collections.Generic; using System.Linq; namespace Humanizer { - class ToTitleCase : IStringTransformer + internal class ToTitleCase : IStringTransformer { public string Transform(string input) { @@ -13,17 +12,23 @@ public string Transform(string input) foreach (var word in words) { if (word.Length == 0 || AllCapitals(word)) + { result.Add(word); - else if(word.Length == 1) + } + else if (word.Length == 1) + { result.Add(word.ToUpper()); - else + } + else + { result.Add(char.ToUpper(word[0]) + word.Remove(0, 1).ToLower()); + } } return string.Join(" ", result); } - static bool AllCapitals(string input) + private static bool AllCapitals(string input) { return input.ToCharArray().All(char.IsUpper); } diff --git a/src/Humanizer/Transformer/ToUpperCase.cs b/src/Humanizer/Transformer/ToUpperCase.cs index b9a3134b5..d904bfa27 100644 --- a/src/Humanizer/Transformer/ToUpperCase.cs +++ b/src/Humanizer/Transformer/ToUpperCase.cs @@ -1,6 +1,6 @@ namespace Humanizer { - class ToUpperCase : IStringTransformer + internal class ToUpperCase : IStringTransformer { public string Transform(string input) { diff --git a/src/Humanizer/TruncateExtensions.cs b/src/Humanizer/TruncateExtensions.cs index 107d166a9..a763a6c1e 100644 --- a/src/Humanizer/TruncateExtensions.cs +++ b/src/Humanizer/TruncateExtensions.cs @@ -56,10 +56,14 @@ public static string Truncate(this string input, int length, string truncationSt public static string Truncate(this string input, int length, string truncationString, ITruncator truncator, TruncateFrom from = TruncateFrom.Right) { if (truncator == null) + { throw new ArgumentNullException(nameof(truncator)); + } if (input == null) + { return null; + } return truncator.Truncate(input, length, truncationString, from); } diff --git a/src/Humanizer/Truncation/FixedLengthTruncator.cs b/src/Humanizer/Truncation/FixedLengthTruncator.cs index 2cd4fa087..806feb132 100644 --- a/src/Humanizer/Truncation/FixedLengthTruncator.cs +++ b/src/Humanizer/Truncation/FixedLengthTruncator.cs @@ -3,26 +3,33 @@ /// /// Truncate a string to a fixed length /// - class FixedLengthTruncator : ITruncator + internal class FixedLengthTruncator : ITruncator { public string Truncate(string value, int length, string truncationString, TruncateFrom truncateFrom = TruncateFrom.Right) { if (value == null) + { return null; + } if (value.Length == 0) + { return value; + } if (truncationString == null || truncationString.Length > length) + { return truncateFrom == TruncateFrom.Right ? value.Substring(0, length) : value.Substring(value.Length - length); - + } if (truncateFrom == TruncateFrom.Left) + { return value.Length > length ? truncationString + value.Substring(value.Length - length + truncationString.Length) : value; + } return value.Length > length ? value.Substring(0, length - truncationString.Length) + truncationString diff --git a/src/Humanizer/Truncation/FixedNumberOfCharactersTruncator.cs b/src/Humanizer/Truncation/FixedNumberOfCharactersTruncator.cs index 62287237e..8afdb79ef 100644 --- a/src/Humanizer/Truncation/FixedNumberOfCharactersTruncator.cs +++ b/src/Humanizer/Truncation/FixedNumberOfCharactersTruncator.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; namespace Humanizer @@ -6,46 +5,64 @@ namespace Humanizer /// /// Truncate a string to a fixed number of letters or digits /// - class FixedNumberOfCharactersTruncator : ITruncator + internal class FixedNumberOfCharactersTruncator : ITruncator { public string Truncate(string value, int length, string truncationString, TruncateFrom truncateFrom = TruncateFrom.Right) { if (value == null) + { return null; + } if (value.Length == 0) + { return value; + } if (truncationString == null) + { truncationString = string.Empty; + } if (truncationString.Length > length) + { return truncateFrom == TruncateFrom.Right ? value.Substring(0, length) : value.Substring(value.Length - length); + } var alphaNumericalCharactersProcessed = 0; if (value.ToCharArray().Count(char.IsLetterOrDigit) <= length) + { return value; + } if (truncateFrom == TruncateFrom.Left) { for (var i = value.Length - 1; i > 0; i--) { if (char.IsLetterOrDigit(value[i])) + { alphaNumericalCharactersProcessed++; + } if (alphaNumericalCharactersProcessed + truncationString.Length == length) + { return truncationString + value.Substring(i); - } + } + } } for (var i = 0; i < value.Length - truncationString.Length; i++) { if (char.IsLetterOrDigit(value[i])) + { alphaNumericalCharactersProcessed++; + } if (alphaNumericalCharactersProcessed + truncationString.Length == length) + { return value.Substring(0, i + 1) + truncationString; + } } return value; diff --git a/src/Humanizer/Truncation/FixedNumberOfWordsTruncator.cs b/src/Humanizer/Truncation/FixedNumberOfWordsTruncator.cs index 8616c4b9a..ce0e63fe3 100644 --- a/src/Humanizer/Truncation/FixedNumberOfWordsTruncator.cs +++ b/src/Humanizer/Truncation/FixedNumberOfWordsTruncator.cs @@ -6,19 +6,25 @@ namespace Humanizer /// /// Truncate a string to a fixed number of words /// - class FixedNumberOfWordsTruncator : ITruncator + internal class FixedNumberOfWordsTruncator : ITruncator { public string Truncate(string value, int length, string truncationString, TruncateFrom truncateFrom = TruncateFrom.Right) { if (value == null) + { return null; + } if (value.Length == 0) + { return value; + } var numberOfWords = value.Split((char[])null, StringSplitOptions.RemoveEmptyEntries).Count(); if (numberOfWords <= length) + { return value; + } return truncateFrom == TruncateFrom.Left ? TruncateFromLeft(value, length, truncationString) @@ -34,16 +40,21 @@ private static string TruncateFromRight(string value, int length, string truncat if (char.IsWhiteSpace(value[i])) { if (!lastCharactersWasWhiteSpace) + { numberOfWordsProcessed++; + } lastCharactersWasWhiteSpace = true; if (numberOfWordsProcessed == length) + { return value.Substring(0, i) + truncationString; + } } else + { lastCharactersWasWhiteSpace = false; - + } } return value + truncationString; } @@ -57,16 +68,21 @@ private static string TruncateFromLeft(string value, int length, string truncati if (char.IsWhiteSpace(value[i])) { if (!lastCharactersWasWhiteSpace) + { numberOfWordsProcessed++; + } lastCharactersWasWhiteSpace = true; if (numberOfWordsProcessed == length) + { return truncationString + value.Substring(i + 1).TrimEnd(); + } } else + { lastCharactersWasWhiteSpace = false; - + } } return truncationString + value; }