Skip to content

Commit

Permalink
Issue #313: Change credit card CheckDigitExtension methods to public
Browse files Browse the repository at this point in the history
  • Loading branch information
bchavez committed Jul 24, 2020
1 parent 54da8a1 commit 590e576
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
26 changes: 26 additions & 0 deletions Source/Bogus.Tests/GitHubIssues/Issue313.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}

}
2 changes: 1 addition & 1 deletion Source/Bogus/Extensions/Extras/CheckDigitExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// </summary>
internal static class CheckDigitExtension
public static class CheckDigitExtension
{
static readonly int[] Results = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9};

Expand Down

0 comments on commit 590e576

Please sign in to comment.