Skip to content
Open
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
19 changes: 18 additions & 1 deletion Faker.Net.NUnit.Tests/AddressTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,22 @@ public void TestWorldCountry()
{
Assert.IsTrue(Regex.IsMatch(Address.GetCountry(), @"[ a-z]"));
}
}
[Test]
public void TestAUState()
{
Assert.IsTrue(Regex.IsMatch(Address.GetAUState(), @"[ a-z]"));
}

[Test]
public void TestAUStateAbbr()
{
Assert.IsTrue(Regex.IsMatch(Address.GetAUStateAbbr(), @"[A-Z]"));
}

[Test]
public void TestAUPostCode()
{
Assert.IsTrue(Regex.IsMatch(Address.GetAUPostcode(), @"[0-9]"));
}
}
}
23 changes: 23 additions & 0 deletions Faker.Net/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,23 @@ public static string GetUKPostcode()
return UK_POSTCODE.Rand().Bothify().ToUpper();
}

// AU Variants
public static string GetAUState()
{
return AU_STATE.Rand();
}

public static string GetAUStateAbbr()
{
return AU_STATE_ABBR.Rand();
}

public static string GetAUPostcode()
{
return AU_POSTCODE.Rand().Numerify();
}


public static string GetNeighborhood()
{
return NEIGHBORHOOD.Rand();
Expand Down Expand Up @@ -268,6 +285,12 @@ public static string Neighborhood()
"Olmsted Falls Central", "South of Lake Shore Blvd", "Gates Mills North", "White Oak South of Columbia Pike",
"Rockville East of Hungerford Dr", "Cleveland Park" };

static readonly string[] AU_STATE = new[] {" New South Wales", "Victoria", "Queensland", "South Australia",
"Western Australia", "Tasmania", "Australian Capital Territory" };

static readonly string[] AU_STATE_ABBR = new[] { "NSW", "VIC", "QLD", "SA", "WA", "TAS", "ACT" };

static readonly string[] AU_POSTCODE = new[] { "####" };
public static readonly string[] COUNTRY =
{
"Åland Islands",
Expand Down