-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added the documentation. * Implemented the Fillmurray faker. * Added dictionary entry. * Added the FillmurrayFaker to the main faker classes.
- Loading branch information
Showing
9 changed files
with
96 additions
and
0 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 |
---|---|---|
@@ -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> |
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,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" | ||
``` |
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,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}"; | ||
} | ||
} | ||
} | ||
|
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,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)); | ||
} | ||
} | ||
} |