-
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.
Merge branch 'master' into feature/lorem-faker
# Conflicts: # src/FakerDotNet/Faker.cs # src/FakerDotNet/FakerContainer.cs # tests/FakerDotNet.Tests/FakerContainerTests.cs # tests/FakerDotNet.Tests/FakerTests.cs
- Loading branch information
Showing
8 changed files
with
171 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace FakerDotNet.Data | ||
{ | ||
internal class FriendsData | ||
{ | ||
public IEnumerable<string> Characters => new[] | ||
{ | ||
"Rachel Green", | ||
"Joey Tribbiani", | ||
"Phoebe Buffay", | ||
"Chandler Bing", | ||
"Monica Geller", | ||
"Ross Geller", | ||
"Richard Burke", | ||
"Janice Goralnik", | ||
"Gunther", | ||
"Emily Waltham", | ||
"Carol Willick", | ||
"Miss Chanandler Bong" | ||
}; | ||
|
||
public IEnumerable<string> Locations => new[] | ||
{ | ||
"Central Perk", | ||
"Javu", | ||
"945 Grove St Apt. 20", | ||
"Ralph Lauren", | ||
"New York Museum of Prehistoric History", | ||
"Days of Our Lives", | ||
"15 Yemen Road, Yemen" | ||
}; | ||
|
||
public IEnumerable<string> Quotes => new[] | ||
{ | ||
"We were on a break!", | ||
"Forty-two to twenty-one! Like the turkey, Ross is done!", | ||
"SEVEN! SEVEN! SEVEN!", | ||
"I'm Monica. I’m disgusting. I stalk guys and keep their underpants.", | ||
"Fine judge all you want but... married a lesbian, left a man at the altar, fell in love with a gay ice dancer, threw a girl’s wooden leg in the fire, LIVE IN A BOX.", | ||
"Welcome to the real world. It sucks. You’re gonna love it!", | ||
"Sure I peed on her. And if I had to, I’d pee on any one of you!", | ||
"If the homo sapiens were, in fact, HOMO sapiens…is that why they’re extinct?", | ||
"It’s a moo point. It’s like a cow’s opinion; it doesn’t matter. It’s moo.", | ||
"You could not be any more wrong. You could try, but you would not be successful.", | ||
"You’ve been BAMBOOZLED!", | ||
"It was summer… and it was hot. Rachel was there… A lonely grey couch…”OH LOOK!” cried Ned, and then the kingdom was his forever. The End.", | ||
"Je m’appelle Claude", | ||
"I’m not so good with the advice. Can I interest you in a sarcastic comment?", | ||
"Raspberries? Good. Ladyfingers? Good. Beef? GOOD!", | ||
"Could I BE wearing any more clothes?", | ||
"Oh no, two women love me. They're both gorgeous and sexy. My wallet's too small for my fifties AND MY DIAMOND SHOES ARE TOO TIGHT." | ||
}; | ||
} | ||
} |
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
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,38 @@ | ||
using FakerDotNet.Data; | ||
|
||
namespace FakerDotNet.Fakers | ||
{ | ||
public interface IFriendsFaker | ||
{ | ||
string Character(); | ||
string Location(); | ||
string Quote(); | ||
} | ||
|
||
internal class FriendsFaker : IFriendsFaker | ||
{ | ||
private static readonly FriendsData Data = new FriendsData(); | ||
|
||
private readonly IFakerContainer _fakerContainer; | ||
|
||
public FriendsFaker(IFakerContainer fakerContainer) | ||
{ | ||
_fakerContainer = fakerContainer; | ||
} | ||
|
||
public string Character() | ||
{ | ||
return _fakerContainer.Random.Element(Data.Characters); | ||
} | ||
|
||
public string Location() | ||
{ | ||
return _fakerContainer.Random.Element(Data.Locations); | ||
} | ||
|
||
public string Quote() | ||
{ | ||
return _fakerContainer.Random.Element(Data.Quotes); | ||
} | ||
} | ||
} |
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
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,59 @@ | ||
using FakeItEasy; | ||
using FakerDotNet.Data; | ||
using FakerDotNet.Fakers; | ||
using NUnit.Framework; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace FakerDotNet.Tests.Fakers | ||
{ | ||
[TestFixture] | ||
[Parallelizable] | ||
public class FriendsFakerTests | ||
{ | ||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_fakerContainer = A.Fake<IFakerContainer>(); | ||
_friendsFaker = new FriendsFaker(_fakerContainer); | ||
} | ||
|
||
private static readonly FriendsData Data = new FriendsData(); | ||
|
||
private IFakerContainer _fakerContainer; | ||
private IFriendsFaker _friendsFaker; | ||
|
||
[Test] | ||
public void Character_returns_a_character() | ||
{ | ||
A.CallTo(() => _fakerContainer.Random.Element( | ||
A<IEnumerable<string>>.That.IsSameSequenceAs(Data.Characters))) | ||
.Returns("Rachel Green"); | ||
|
||
Assert.AreEqual("Rachel Green", _friendsFaker.Character()); | ||
} | ||
|
||
[Test] | ||
public void Location_returns_a_location() | ||
{ | ||
A.CallTo(() => _fakerContainer.Random.Element( | ||
A<IEnumerable<string>>.That.IsSameSequenceAs(Data.Locations))) | ||
.Returns("15 Yemen Road, Yemen"); | ||
|
||
Assert.AreEqual("15 Yemen Road, Yemen", _friendsFaker.Location()); | ||
} | ||
|
||
[Test] | ||
public void Quote_returns_a_quote() | ||
{ | ||
A.CallTo(() => _fakerContainer.Random.Element( | ||
A<IEnumerable<string>>.That.IsSameSequenceAs(Data.Quotes))) | ||
.Returns("Forty-two to twenty-one! Like the turkey, Ross is done!"); | ||
|
||
Assert.AreEqual("Forty-two to twenty-one! Like the turkey, Ross is done!", _friendsFaker.Quote()); | ||
} | ||
} | ||
} |