Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<RepositoryType>git</RepositoryType>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>autopoco;testdata;test-data;poco;generator;fluent;fake-data</PackageTags>
<PackageReleaseNotes>6.1: New data sources for trade identifiers in holonsoft.AutoPoco.DataSources.Identifiers: GtinSource and Ean13Source (GTIN-8/12/13/14, i.e. EAN-8, UPC-A, EAN-13 and ITF-14, with a valid GS1 mod 10 check digit and an optional GS1 company prefix), SsccSource (the eighteen digit number of a logistic unit, same GS1 check digit, optional prefix), IsbnSource (ISBN-13 inside an allocated registration group, ISBN-10 with its mod 11 check digit including the X), IssnSource (mod 11 check character including the X), IsinSource (a real country prefix or a given one, Luhn over the expanded letters), ImeiSource (Luhn check digit, optional Type Allocation Code prefix) and AsinSource, each with a Nullable variant. IbanSource generates the IBAN of any SEPA country with correct mod 97 check digits and the national check digits inside the BBAN (BE, EE, ES, FI, FR/MC, HU, IS, IT/SM, NO, PL, PT, SI), TestBlzIbanSource a German IBAN on a bank code outside the assigned range so the number is recognisable as test data, and VatIdSource a VAT ID with a valid check digit for AT, BE, DE, DK, EE, FI, GB, HR, HU, IE, IT, LT, LU, NL, PL, PT, SE, SI, SK and XI, calibrated against the official construction rules; countries that have not published their rules are left out on purpose. TestBinCreditCardSource in holonsoft.AutoPoco.DataSources.Business builds card numbers on the six digit test BINs the payment processors publish, so the data is recognisable as test data. Bug fixes: CreditCardSource doubled the wrong digits when calculating the Luhn check digit, so its numbers failed a real Luhn validation; and only the first digit of the scheme was fixed, so an "American Express" could be detected as a Diners Club and a "MasterCard" could start with 56, a range no scheme issues. Every number now carries a correct check digit and starts inside a range its scheme really issues in (34/37 for American Express, 51-55 and 2221-2720 for Mastercard, 6011/644-649/65 for Discover), and the generated sequences changed once for that. 6.0: Lambda data sources (FuncSource, Setup(...).From(() => ...), Source(expr, () => ...) at generation time). Opt-in nullability-aware null generation via RespectNullableAnnotations(threshold). Generic NumberSource&lt;T&gt; and NullableNumberSource&lt;T&gt; with min/max for every built-in numeric type (integers uniform and inclusive, floating point and decimal overflow safe). Records and immutable types are constructed through their constructor, parameters are fed from the registered members with the same name, no parameterless constructor needed anymore; unconfigured struct parameters stay default instead of throwing. Seeds: UseSeed(seed) per factory, CreateSession(recursionLimit, seed) per session, every member gets its own stream derived from the seed. Own deterministic generator (StableRandom, xoshiro256**) instead of System.Random, sequences are stable across .NET versions. Breaking: AutoPocoGlobalSettings removed (AutoPocoDefaults constants instead), every generated sequence changed once, the max of IntegerSource/LongSource/RandomNumberSource and their nullable variants is inclusive now (it was exclusive), Int128Source/NullableInt128Source pick uniformly instead of clamping to the bounds (they never produced a negative value before), RandomStringSource and UrlSource reach the last character resp. the last top level domain, ColorSource/RandomTextSource/RandomUtfTextSource treat their maximum as inclusive, ColorSource applies the alpha of SetColorRange, and UrlSource and ExtendedEmailAddressSource seed their nested sources (the URL host ignored the session seed completely). CreditCardSource never produced a Discover card. TimeSpanSource was rewritten: it returned TimeSpan.MinValue on every draw of the default range, produced values outside a requested range and looped forever on a reversed one. DoubleSource returned infinity over its default range, DoubleSource/FloatSource/DecimalSource interpolate overflow safe now and DecimalSource keeps its full precision. Index-aware Impose on lists and selections (value from the position, or from position and item), Impose(member, item => value) on a single generator. Invoke arguments: Use.From(lambda), constants and variables arrive as values. Context lambdas get a non-nullable IGenerationContext. Argument validation over the public API, meaningful exception messages, XML documentation file. IDataSource&lt;T&gt; is covariant. Bug fixes: Nullable* sources honor an explicit null creation threshold (null positions of stable sequences changed), DateTime/DateOnly/TimeOnly/DateOfBirth sources cover their whole range including the upper bound (sequences changed), RandomUtfTextSource no longer loops forever. Build and packaging modernized: GitHub Actions CI, trusted publishing to nuget.org, MinVer tag based versioning, central package management, xunit.v3 tests on net8/9/10. FluentAssertions and Moq are no longer dependencies of the library. See README for details.</PackageReleaseNotes>
<PackageReleaseNotes>6.1: New data sources for trade identifiers in holonsoft.AutoPoco.DataSources.Identifiers: GtinSource and Ean13Source (GTIN-8/12/13/14, i.e. EAN-8, UPC-A, EAN-13 and ITF-14, with a valid GS1 mod 10 check digit and an optional GS1 company prefix), SsccSource (the eighteen digit number of a logistic unit, same GS1 check digit, optional prefix), IsbnSource (ISBN-13 inside an allocated registration group, ISBN-10 with its mod 11 check digit including the X), IssnSource (mod 11 check character including the X), IsinSource (a real country prefix or a given one, Luhn over the expanded letters), ImeiSource (Luhn check digit, optional Type Allocation Code prefix) and AsinSource, each with a Nullable variant. IbanSource generates the IBAN of any SEPA country with correct mod 97 check digits and the national check digits inside the BBAN (BE, EE, ES, FI, FR/MC, HU, IS, IT/SM, NO, PL, PT, SI), TestBlzIbanSource a German IBAN on a bank code outside the assigned range so the number is recognisable as test data, and VatIdSource a VAT ID with a valid check digit for AT, BE, DE, DK, EE, FI, GB, HR, HU, IE, IT, LT, LU, NL, PL, PT, SE, SI, SK and XI, calibrated against the official construction rules; countries that have not published their rules are left out on purpose. More sources: VinSource (North American check digit, model year per 49 CFR 565, optional WMI prefix), MacAddressSource and TestMacAddressSource (universally vs. locally administered unicast, three formats), GuidV7Source (RFC 9562 version 7 UUIDs whose timestamp comes from a seeded range instead of the clock), PatternSource (# digit, @ letter, * both, backslash escapes) with SkuSource, SerialNumberSource and LotNumberSource (seeded year plus day-of-year date code) on top, and LatitudeSource/LongitudeSource with bounding box. EoriSource generates EORI customs numbers for BE, DE, DK, FR, GB, HR, IT, NL, PL and XI, the national part built from the underlying national identifier with its real check digits (enterprise number, CVR, SIRET, OIB, partita IVA, NIP, VAT registration number). TestBinCreditCardSource in holonsoft.AutoPoco.DataSources.Business builds card numbers on the six digit test BINs the payment processors publish, so the data is recognisable as test data. Bug fixes: CreditCardSource doubled the wrong digits when calculating the Luhn check digit, so its numbers failed a real Luhn validation; and only the first digit of the scheme was fixed, so an "American Express" could be detected as a Diners Club and a "MasterCard" could start with 56, a range no scheme issues. Every number now carries a correct check digit and starts inside a range its scheme really issues in (34/37 for American Express, 51-55 and 2221-2720 for Mastercard, 6011/644-649/65 for Discover), and the generated sequences changed once for that. 6.0: Lambda data sources (FuncSource, Setup(...).From(() => ...), Source(expr, () => ...) at generation time). Opt-in nullability-aware null generation via RespectNullableAnnotations(threshold). Generic NumberSource&lt;T&gt; and NullableNumberSource&lt;T&gt; with min/max for every built-in numeric type (integers uniform and inclusive, floating point and decimal overflow safe). Records and immutable types are constructed through their constructor, parameters are fed from the registered members with the same name, no parameterless constructor needed anymore; unconfigured struct parameters stay default instead of throwing. Seeds: UseSeed(seed) per factory, CreateSession(recursionLimit, seed) per session, every member gets its own stream derived from the seed. Own deterministic generator (StableRandom, xoshiro256**) instead of System.Random, sequences are stable across .NET versions. Breaking: AutoPocoGlobalSettings removed (AutoPocoDefaults constants instead), every generated sequence changed once, the max of IntegerSource/LongSource/RandomNumberSource and their nullable variants is inclusive now (it was exclusive), Int128Source/NullableInt128Source pick uniformly instead of clamping to the bounds (they never produced a negative value before), RandomStringSource and UrlSource reach the last character resp. the last top level domain, ColorSource/RandomTextSource/RandomUtfTextSource treat their maximum as inclusive, ColorSource applies the alpha of SetColorRange, and UrlSource and ExtendedEmailAddressSource seed their nested sources (the URL host ignored the session seed completely). CreditCardSource never produced a Discover card. TimeSpanSource was rewritten: it returned TimeSpan.MinValue on every draw of the default range, produced values outside a requested range and looped forever on a reversed one. DoubleSource returned infinity over its default range, DoubleSource/FloatSource/DecimalSource interpolate overflow safe now and DecimalSource keeps its full precision. Index-aware Impose on lists and selections (value from the position, or from position and item), Impose(member, item => value) on a single generator. Invoke arguments: Use.From(lambda), constants and variables arrive as values. Context lambdas get a non-nullable IGenerationContext. Argument validation over the public API, meaningful exception messages, XML documentation file. IDataSource&lt;T&gt; is covariant. Bug fixes: Nullable* sources honor an explicit null creation threshold (null positions of stable sequences changed), DateTime/DateOnly/TimeOnly/DateOfBirth sources cover their whole range including the upper bound (sequences changed), RandomUtfTextSource no longer loops forever. Build and packaging modernized: GitHub Actions CI, trusted publishing to nuget.org, MinVer tag based versioning, central package management, xunit.v3 tests on net8/9/10. FluentAssertions and Moq are no longer dependencies of the library. See README for details.</PackageReleaseNotes>
</PropertyGroup>

<PropertyGroup Label="Package build">
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ Each has a `Nullable...` variant. The structures come from the SWIFT IBAN regist

One warning, stronger than for the credit cards: an IBAN needs no CVV and no second factor for a SEPA direct debit, so a generated IBAN that coincidentally names a real account is a sharper tool than a generated card number. `IbanSource` draws its bank codes, so use `TestBlzIbanSource` whenever the data leaves your test systems. A generated VAT ID is harmless in comparison, VIES simply reports it as not registered.

## Devices, codes and coordinates

| Source | Produces |
| --- | --- |
| `VinSource` | A seventeen character vehicle identification number with the valid North American check digit at position nine, I, O and Q never appear, and the model year position follows 49 CFR 565. A prefix pins the world manufacturer identifier, e.g. `new VinSource("WVW")`. |
| `MacAddressSource` | A unicast MAC address as upper case hex, colons, hyphens or bare via `MacAddressFormat`. The plain source draws universally administered addresses; `TestMacAddressSource` sets the locally administered bit, the space IEEE 802 keeps free of manufacturer assignments, so those addresses provably name no vendor hardware. |
| `GuidV7Source` | An RFC 9562 version 7 UUID whose 48 timestamp bits are drawn from a seeded date range instead of the clock, so the same seed gives the same UUIDs on every run. Version and variant bits are correct and the encoded instant stays inside the range. |
| `PatternSource` | A string from a pattern: `#` digit, `@` capital letter, `*` both, backslash escapes, everything else literal. `"@@@-#####"` gives `KDX-83741`. The building block for every code that follows no public standard. |
| `SkuSource` | An SKU, `@@@-#####` unless another pattern is given. An SKU is merchant convention, so the pattern is the contract; for standardised article numbers use `GtinSource` and friends. |
| `SerialNumberSource` | A serial number, four blocks of four characters unless another pattern is given. |
| `LotNumberSource` | A lot or batch number with the widespread date code of two digit year plus day of the year, e.g. `L26265-0387`, the date drawn from a seeded range, never from the clock. |
| `LatitudeSource`, `LongitudeSource` | Decimal degrees, the whole world unless a bounding box is given, e.g. `new LatitudeSource(47, 55)` with `new LongitudeSource(5, 15)`. The two members are drawn independently; where the pair has to name one meaningful place, build it with `Impose`. |
| `EoriSource` | An EORI customs number (Annex 12-01 UCC IA) for BE, DE, DK, FR, GB, HR, IT, NL, PL and XI. The format itself has no check digit, but the national part is built from the underlying national identifier with its real checks: the Belgian enterprise number, the Danish CVR, a doubly Luhn-valid French SIRET, the Croatian OIB, the Italian partita IVA, the Polish NIP plus `00000`, the UK VAT registration number plus `000`. Austria publishes no structure and the Portuguese third country check digit is unpublished, so both stay out. |

Each has a `Nullable...` variant.

## holonsoft.AutoPoco.Faker, realistic values from Bogus

A separate, optional package. The core package keeps its promise of having no dependency, and who wants believable names and addresses installs one more:
Expand Down
Loading
Loading