diff --git a/src/Humanizer.Tests.Shared/ToQuantityTests.cs b/src/Humanizer.Tests.Shared/ToQuantityTests.cs index bf942d1ba..5e52e215b 100644 --- a/src/Humanizer.Tests.Shared/ToQuantityTests.cs +++ b/src/Humanizer.Tests.Shared/ToQuantityTests.cs @@ -22,7 +22,6 @@ public class ToQuantityTests public void ToQuantity(string word, int quantity, string expected) { Assert.Equal(expected, word.ToQuantity(quantity)); - Assert.Equal(expected, word.ToQuantity((long)quantity)); } [Theory] @@ -40,7 +39,6 @@ public void ToQuantity(string word, int quantity, string expected) 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] @@ -57,9 +55,7 @@ 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 Assert.Equal(expected, word.ToQuantity(quantity, ShowQuantityAs.Numeric)); - Assert.Equal(expected, word.ToQuantity((long)quantity, ShowQuantityAs.Numeric)); } [Theory] @@ -78,7 +74,6 @@ public void ToQuantityNumeric(string word, int quantity, string expected) public void ToQuantityWords(string word, int quantity, string expected) { Assert.Equal(expected, word.ToQuantity(quantity, ShowQuantityAs.Words)); - Assert.Equal(expected, word.ToQuantity((long)quantity, ShowQuantityAs.Words)); } [Theory] @@ -96,7 +91,6 @@ public void ToQuantityWords(string word, int quantity, string expected) public void ToQuantityWordsWithCurrentCultureFormatting(string word, int quantity, string format, string expected) { Assert.Equal(expected, word.ToQuantity(quantity, format)); - Assert.Equal(expected, word.ToQuantity((long)quantity, format)); } [Theory] @@ -114,7 +108,6 @@ public void ToQuantityWordsWithCustomCultureFormatting(string word, int quantity 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)); } internal static StringComparer GetStringComparer(CultureInfo culture) diff --git a/src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.approve_public_api.approved.txt b/src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.approve_public_api.approved.txt index a94665fa7..d2ef7a8f0 100644 --- a/src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.approve_public_api.approved.txt +++ b/src/Humanizer.Tests/ApiApprover/PublicApiApprovalTest.approve_public_api.approved.txt @@ -1010,8 +1010,6 @@ namespace Humanizer } public class static ToQuantityExtensions { - public static string ToQuantity(this string input, int quantity, Humanizer.ShowQuantityAs showQuantityAs = 1) { } - public static string ToQuantity(this string input, int quantity, string format, System.IFormatProvider formatProvider = null) { } public static string ToQuantity(this string input, long quantity, Humanizer.ShowQuantityAs showQuantityAs = 1) { } public static string ToQuantity(this string input, long quantity, string format, System.IFormatProvider formatProvider = null) { } } diff --git a/src/Humanizer/ToQuantityExtensions.cs b/src/Humanizer/ToQuantityExtensions.cs index 90ad2cc77..1f5202c1e 100644 --- a/src/Humanizer/ToQuantityExtensions.cs +++ b/src/Humanizer/ToQuantityExtensions.cs @@ -30,43 +30,7 @@ public enum ShowQuantityAs /// public static class ToQuantityExtensions { - /// - /// Prefixes the provided word with the number and accordingly pluralizes or singularizes the word - /// - /// The word to be prefixed - /// The quantity of the word - /// How to show the quantity. Numeric by default - /// - /// "request".ToQuantity(0) => "0 requests" - /// "request".ToQuantity(1) => "1 request" - /// "request".ToQuantity(2) => "2 requests" - /// "men".ToQuantity(2) => "2 men" - /// "process".ToQuantity(1200, ShowQuantityAs.Words) => "one thousand two hundred processes" - /// - /// - public static string ToQuantity(this string input, int quantity, ShowQuantityAs showQuantityAs = ShowQuantityAs.Numeric) - { - return input.ToQuantity(quantity, showQuantityAs, format: null, formatProvider: null); - } - - /// - /// Prefixes the provided word with the number and accordingly pluralizes or singularizes the word - /// - /// The word to be prefixed - /// The quantity of the word - /// A standard or custom numeric format string. - /// An object that supplies culture-specific formatting information. - /// - /// "request".ToQuantity(0) => "0 requests" - /// "request".ToQuantity(10000, format: "N0") => "10,000 requests" - /// "request".ToQuantity(1, format: "N0") => "1 request" - /// - /// - public static string ToQuantity(this string input, int quantity, string format, IFormatProvider formatProvider = null) - { - return input.ToQuantity(quantity, showQuantityAs: ShowQuantityAs.Numeric, format: format, formatProvider: formatProvider); - } - + /// /// Prefixes the provided word with the number and accordingly pluralizes or singularizes the word ///