Skip to content

Commit

Permalink
Fixed minor bug in Person.Email field.
Browse files Browse the repository at this point in the history
  • Loading branch information
bchavez committed Jul 15, 2017
1 parent 660011d commit f8eb9cd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/Bogus.Tests/DataSetTests/CardTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void should_be_able_to_get_a_contextually_bogus_person()
card.FirstName.Should().Be("Lee");
card.LastName.Should().Be("Brown");
card.UserName.Should().Be("Lee_Brown3");
card.Email.Should().Be("Lee_Brown369@yahoo.com");
card.Email.Should().Be("Lee69@yahoo.com");

card.Dump();
}
Expand Down
30 changes: 29 additions & 1 deletion Source/Bogus.Tests/PersonTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
using Bogus.Extensions.UnitedStates;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

namespace Bogus.Tests
{
public class PersonTest : SeededTest
{
public class User
private readonly ITestOutputHelper console;

public PersonTest(ITestOutputHelper console)
{
this.console = console;
}

public class User
{
public string FirstName { get; set; }
public string Email { get; set; }
Expand Down Expand Up @@ -116,6 +124,26 @@ public void can_generate_henkilötunnus_for_finland()
b.Length.Should().Be(4);
}

[Fact]
public void check_emails()
{
var emails = Get(10, p => p.Email);

emails.Should().ContainInOrder(
"Lee69@yahoo.com",
"Michale_Stiedemann94@gmail.com",
"Grayson_Harvey@yahoo.com",
"Anne.Ruecker@gmail.com",
"Vilma.Beer51@yahoo.com",
"Loraine_Sipes@yahoo.com",
"Haylie_Reilly29@yahoo.com",
"Sandrine_Watsica76@gmail.com",
"Madisyn6@yahoo.com",
"Austin.Marks1@hotmail.com");

console.WriteLine(emails.DumpString());
}

IEnumerable<string> Get(int times, Func<Person, string> a)
{
return Enumerable.Range(0, times)
Expand Down
2 changes: 1 addition & 1 deletion Source/Bogus/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected virtual void Initialize(string locale)
var ginternet = new Internet(locale);

this.UserName = ginternet.UserName(this.FirstName, this.LastName);
this.Email = ginternet.Email(this.UserName, this.LastName);
this.Email = ginternet.Email(this.FirstName, this.LastName);
this.Website = ginternet.DomainName();
this.Avatar = ginternet.Avatar();

Expand Down

0 comments on commit f8eb9cd

Please sign in to comment.