-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,351 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Faker.Company | ||
|
||
```cs | ||
Faker.Company.Name() //=> "Hirthe-Ritchie" | ||
Faker.Company.Suffix() //=> "Group" | ||
Faker.Company.Industry() //=> "Information Services" | ||
// Generate a buzzword-laden catch phrase. | ||
Faker.Company.CatchPhrase() //=> "Business-focused coherent parallelism" | ||
Faker.Company.Buzzword() //=> "Business-focused" | ||
// When a straight answer won't do, BS to the rescue! | ||
Faker.Company.Bs() //=> "empower one-to-one web-readiness" | ||
// Generate US employee identification numbers | ||
Faker.Company.Ein() //=> "34-8488813" | ||
// Generate "Data Universal Numbering System" | ||
Faker.Company.DunsNumber() //=> "08-341-3736" | ||
// Get a random company logo url in PNG format. | ||
Faker.Company.Logo() //=> "https://pigment.github.io/fake-logos/logos/medium/color/5.png" | ||
Faker.Company.Type() //=> "Privately Held" | ||
#//Get a random profession | ||
Faker.Company.Profession() //=> "firefighter" | ||
// Generate country specific identifiers | ||
Faker.Company.SwedishOrganisationNumber() //=> "7962578022" | ||
Faker.Company.CzechOrganisationNumber() //=> "77778171" | ||
Faker.Company.FrenchSirenNumber() //=> "819489626" | ||
Faker.Company.FrenchSiretNumber() //=> "81948962600013" | ||
Faker.Company.SpanishOrganisationNumber() //=> "P2344979" | ||
// Generate South African company registration numbers: | ||
Faker.Company.SouthAfricanPtyLtdRegistrationNumber() //=> "5301/714689/07" | ||
Faker.Company.SouthAfricanCloseCorporationRegistrationNumber() //=> "CK74/7585/23" | ||
Faker.Company.SouthAfricanListedCompanyRegistrationNumber() //=> "7039/3135/06" | ||
Faker.Company.SouthAfricanTrustRegistrationNumber() //=> "IT38/6489900" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Linq; | ||
|
||
namespace FakerDotNet.Algorithms | ||
{ | ||
internal static class LuhnAlgorithm | ||
{ | ||
public static int GetCheckValue(long number) | ||
{ | ||
var sum = $"{number}" | ||
.ToCharArray() | ||
.Reverse() | ||
.Select(c => int.Parse(new string(c, 1))) | ||
.Select((x, i) => i % 2 == 0 ? x * 2 : x) | ||
.Select(SumAllDigits) | ||
.Sum(); | ||
|
||
return sum % 10 == 0 ? 0 : (sum / 10 + 1) * 10 - sum; | ||
} | ||
|
||
private static int SumAllDigits(int number) | ||
{ | ||
return $"{number}" | ||
.ToCharArray() | ||
.Sum(c => int.Parse(new string(c, 1))); | ||
} | ||
} | ||
} |
Oops, something went wrong.