Skip to content

Commit

Permalink
Fixes #88 - 💄 API aesthetics: Added Name.FullName() convenience met…
Browse files Browse the repository at this point in the history
…hod to generate a full name.
  • Loading branch information
bchavez committed Aug 21, 2017
1 parent f28630b commit 4948528
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v15.0.7
* Issue #88 - API aesthetics: Added `Name.FullName()` convenience method to generate a full name.

## v15.0.6
* PR #87: Added `.Rules()` method on `RuleSet`. Thanks @digitalcyote.

Expand Down
6 changes: 6 additions & 0 deletions Source/Bogus.Tests/DataSetTests/NameTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,11 @@ public void switch_locale_syntax()
//switch to EN
n["en"].LastName().Should().Be("Schultz");
}

[Fact]
public void can_get_a_full_name()
{
name.FullName().Should().Be("Lee Brown");
}
}
}
9 changes: 9 additions & 0 deletions Source/Bogus/DataSets/Name.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ public string LastName(Gender? gender = null)
return GetRandomArrayItem("last_name");
}

/// <summary>
/// Get a full name, concatenation of calling FirstName and LastName.
/// </summary>
/// <param name="gender">Gender of the name if supported by the locale.</param>
public string FullName(Gender? gender = null)
{
return $"{FirstName(gender)} {LastName(gender)}";
}

/// <summary>
/// Gets a random prefix for a name
/// </summary>
Expand Down

0 comments on commit 4948528

Please sign in to comment.