Skip to content

Commit

Permalink
Merge 034af31 into bd4ba7d
Browse files Browse the repository at this point in the history
  • Loading branch information
mrstebo committed Feb 1, 2019
2 parents bd4ba7d + 034af31 commit 1003cd2
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 0 deletions.
1 change: 1 addition & 0 deletions FakerDotNet.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RNG/@EntryIndexedValue">RNG</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=grayscale/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ukelele/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ A .NET port of the Ruby [faker](https://github.com/stympy/faker) gem
- [Faker.DragonBall](doc/dragon_ball.md)
- [Faker.Fake](doc/fake.md)
- [Faker.File](doc/file.md)
- [Faker.Fillmurray](doc/fillmurray.md)
- [Faker.Food](doc/food.md)
- [Faker.GameOfThrones](doc/game_of_thrones.md)
- [Faker.Hacker](doc/hacker.md)
Expand Down
9 changes: 9 additions & 0 deletions doc/fillmurray.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Faker.Fillmurray

```cs
Faker.Fillmurray.Image() //=> "http://fillmurray.com/300/300"
Faker.Fillmurray.Image(true) //=> "http://fillmurray.com/g/300/300"
Faker.Fillmurray.Image(false, 200, 400) //=> "http://fillmurray.com/200/400"
```
1 change: 1 addition & 0 deletions src/FakerDotNet/Faker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static class Faker
public static IDragonBallFaker DragonBall { get; } = Container.DragonBall;
public static IFakeFaker Fake { get; } = Container.Fake;
public static IFileFaker File { get; } = Container.File;
public static IFillmurrayFaker Fillmurray { get; } = Container.Fillmurray;
public static IFoodFaker Food { get; } = Container.Food;
public static IFriendsFaker Friends { get; } = Container.Friends;
public static IGameOfThronesFaker GameOfThrones { get; } = Container.GameOfThrones;
Expand Down
3 changes: 3 additions & 0 deletions src/FakerDotNet/FakerContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ internal interface IFakerContainer
IDragonBallFaker DragonBall { get; }
IFakeFaker Fake { get; }
IFileFaker File { get; }
IFillmurrayFaker Fillmurray { get; }
IFoodFaker Food { get; }
IFriendsFaker Friends { get; }
IGameOfThronesFaker GameOfThrones { get; }
Expand Down Expand Up @@ -69,6 +70,7 @@ public FakerContainer()
DragonBall = new DragonBallFaker(this);
Fake = new FakeFaker(this);
File = new FileFaker(this);
Fillmurray = new FillmurrayFaker();
Food = new FoodFaker(this);
Friends = new FriendsFaker(this);
GameOfThrones = new GameOfThronesFaker(this);
Expand Down Expand Up @@ -113,6 +115,7 @@ public FakerContainer()
public IDragonBallFaker DragonBall { get; }
public IFakeFaker Fake { get; }
public IFileFaker File { get; }
public IFillmurrayFaker Fillmurray { get; }
public IFoodFaker Food { get; }
public IFriendsFaker Friends { get; }
public IGameOfThronesFaker GameOfThrones { get; }
Expand Down
18 changes: 18 additions & 0 deletions src/FakerDotNet/Fakers/FillmurrayFaker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace FakerDotNet.Fakers
{
public interface IFillmurrayFaker
{
string Image(bool grayscale = false, int width = 200, int height = 200);
}

internal class FillmurrayFaker : IFillmurrayFaker
{
public string Image(bool grayscale = false, int width = 200, int height = 200)
{
return grayscale
? $"https://fillmurray.com/g/{width}/{height}"
: $"https://fillmurray.com/{width}/{height}";
}
}
}

6 changes: 6 additions & 0 deletions tests/FakerDotNet.Tests/FakerContainerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ public void File_returns_IFileFaker()
Assert.IsInstanceOf<IFileFaker>(_fakerContainer.File);
}

[Test]
public void Fillmurray_returns_IFillmurrayFaker()
{
Assert.IsInstanceOf<IFillmurrayFaker>(_fakerContainer.Fillmurray);
}

[Test]
public void Food_returns_IFoodFaker()
{
Expand Down
6 changes: 6 additions & 0 deletions tests/FakerDotNet.Tests/FakerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ public void File_returns_IFileFaker()
Assert.IsInstanceOf<IFileFaker>(Faker.File);
}

[Test]
public void Fillmurray_returns_IFillmurrayFaker()
{
Assert.IsInstanceOf<IFillmurrayFaker>(Faker.Fillmurray);
}

[Test]
public void Food_returns_IFoodFaker()
{
Expand Down
51 changes: 51 additions & 0 deletions tests/FakerDotNet.Tests/Fakers/FillmurrayFakerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using FakeItEasy;
using FakerDotNet.Fakers;
using NUnit.Framework;

namespace FakerDotNet.Tests.Fakers
{
[TestFixture]
[Parallelizable]
public class FillmurrayFakerTests
{
[SetUp]
public void SetUp()
{
_fillmurrayFaker = new FillmurrayFaker();
}

private IFillmurrayFaker _fillmurrayFaker;

[Test]
public void Image_returns_an_image_url()
{
Assert.AreEqual(
"https://fillmurray.com/200/200",
_fillmurrayFaker.Image());
}

[Test]
public void Image_returns_an_image_url_for_a_grayscale_image_when_specified()
{
Assert.AreEqual(
"https://fillmurray.com/g/200/200",
_fillmurrayFaker.Image(true));
}

[Test]
public void Image_returns_an_image_url_with_the_specified_width()
{
Assert.AreEqual(
"https://fillmurray.com/300/200",
_fillmurrayFaker.Image(false, 300));
}

[Test]
public void Image_returns_an_image_url_with_the_specified_height()
{
Assert.AreEqual(
"https://fillmurray.com/200/400",
_fillmurrayFaker.Image(false, 200, 400));
}
}
}

0 comments on commit 1003cd2

Please sign in to comment.