Skip to content

Commit

Permalink
Fixes #318 - Added f.Address.CountryOfUnitedKingdom() extension met…
Browse files Browse the repository at this point in the history
…hod in `Bogus.Extensions.UnitedKingdom`.
  • Loading branch information
bchavez committed Aug 14, 2020
1 parent 4f65c5e commit 65ab500
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v30.0.3
Release Date: 2020-08-13

* Added `f.Address.CountryOfUnitedKingdom()` extension method in `Bogus.Extensions.UnitedKingdom`.

## v30.0.2
Release Date: 2020-08-05

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ public void Using_FakerT_Inheritance()
* `Bogus.Person.Nif()` - Número de Identificação Fiscal (NIF)
* `Bogus.DataSets.Company.Nipc()` - Número de Identificação de Pessoa Colectiva (NIPC)
* **`using Bogus.Extensions.UnitedKingdom;`**
* `Bogus.DataSets.Address.CountryOfUnitedKingdom()` - Country of the United Kingdom
* `Bogus.DataSets.Finance.SortCode()` - Banking Sort Code
* `Bogus.DataSets.Finance.Nino()` - National Insurance Number
* `Bogus.DataSets.Vehicle.GbRegistrationPlate()` - GB Vehicle Registration Plate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Bogus.Bson;
using Bogus.DataSets;

namespace Bogus.Extensions.UnitedKingdom
Expand Down Expand Up @@ -58,5 +59,14 @@ public static string Nino(this Finance finance, bool includeSeparator = true)
}
return finance.Random.ReplaceNumbers($"{prefix}######{suffix}");
}

/// <summary>
/// Country of the United Kingdom
/// </summary>
public static string CountryOfUnitedKingdom(this Address address)
{
var countries = Database.Get(nameof(address), "uk_country", "en_GB") as BArray;
return address.Random.ArrayElement(countries);
}
}
}

0 comments on commit 65ab500

Please sign in to comment.