Skip to content

Commit 590e576

Browse files
committed
Issue #313: Change credit card CheckDigitExtension methods to public
1 parent 54da8a1 commit 590e576

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v30.0.1-beta-4
2+
Release Date: 2020-07-23
3+
4+
* Change credit card `CheckDigitExtension` methods to public
5+
16
## v30.0.1-beta-3
27
Release Date: 2020-06-29
38

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Xunit;
2+
using Bogus.Extensions.Extras;
3+
using FluentAssertions;
4+
5+
namespace Bogus.Tests.GitHubIssues
6+
{
7+
public class Issue313 : SeededTest
8+
{
9+
[Fact]
10+
public void can_create_custom_credit_card_number_PAN()
11+
{
12+
var f = new Faker();
13+
Visa16Digit(f).Should()
14+
.HaveLength(16)
15+
.And
16+
.Be("4618606064391758");
17+
}
18+
19+
public static string Visa16Digit(Faker f)
20+
{
21+
const string format = "4##############";
22+
return f.Random.ReplaceNumbers(format).AppendCheckDigit();
23+
}
24+
}
25+
26+
}

Source/Bogus/Extensions/Extras/CheckDigitExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Bogus.Extensions.Extras
77
/// Shamelessly copied (and modified) from here:
88
/// https://stackoverflow.com/questions/21249670/implementing-luhn-algorithm-using-c-sharp
99
/// </summary>
10-
internal static class CheckDigitExtension
10+
public static class CheckDigitExtension
1111
{
1212
static readonly int[] Results = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9};
1313

0 commit comments

Comments
 (0)