diff --git a/HISTORY.md b/HISTORY.md index 3ffb70ed..923e417d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,8 @@ +## v30.0.1-beta-4 +Release Date: 2020-07-23 + +* Change credit card `CheckDigitExtension` methods to public + ## v30.0.1-beta-3 Release Date: 2020-06-29 diff --git a/Source/Bogus.Tests/GitHubIssues/Issue313.cs b/Source/Bogus.Tests/GitHubIssues/Issue313.cs new file mode 100644 index 00000000..a216bbbd --- /dev/null +++ b/Source/Bogus.Tests/GitHubIssues/Issue313.cs @@ -0,0 +1,26 @@ +using Xunit; +using Bogus.Extensions.Extras; +using FluentAssertions; + +namespace Bogus.Tests.GitHubIssues +{ + public class Issue313 : SeededTest + { + [Fact] + public void can_create_custom_credit_card_number_PAN() + { + var f = new Faker(); + Visa16Digit(f).Should() + .HaveLength(16) + .And + .Be("4618606064391758"); + } + + public static string Visa16Digit(Faker f) + { + const string format = "4##############"; + return f.Random.ReplaceNumbers(format).AppendCheckDigit(); + } + } + +} \ No newline at end of file diff --git a/Source/Bogus/Extensions/Extras/CheckDigitExtension.cs b/Source/Bogus/Extensions/Extras/CheckDigitExtension.cs index 51fb0f6c..8231467d 100644 --- a/Source/Bogus/Extensions/Extras/CheckDigitExtension.cs +++ b/Source/Bogus/Extensions/Extras/CheckDigitExtension.cs @@ -7,7 +7,7 @@ namespace Bogus.Extensions.Extras /// Shamelessly copied (and modified) from here: /// https://stackoverflow.com/questions/21249670/implementing-luhn-algorithm-using-c-sharp /// - internal static class CheckDigitExtension + public static class CheckDigitExtension { static readonly int[] Results = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9};