bchavez / Bogus

:card_index: A simple fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Other
8.62k stars 491 forks source link

United Kingdom Extensions: Added NHSNumber generator to Person #483

Open JohnStabler opened 1 year ago

JohnStabler commented 1 year ago

NHS numbers at 10 digits long. The last digit is a check digit

bchavez commented 7 months ago

Hi. I think we need a unit test for this. Also, is there a way to generate an NHS number without the do/while loop?

Generally, it's a bad/anti-pattern for generators to have a do -> while -> test-if-valid -> do-again-if-not-valid in Bogus.

A better implementation would be a straight one-shot generation of the NHS number after calling the generation method.