Skip to content

Commit 070a9dc

Browse files
authored
Remove LoremPixel image service (#556)
1 parent 3a76b00 commit 070a9dc

File tree

5 files changed

+1
-300
lines changed

5 files changed

+1
-300
lines changed

README.md

-14
Original file line numberDiff line numberDiff line change
@@ -365,20 +365,6 @@ In the examples above, all three alternative styles of using **Bogus** produce t
365365
* `PicsumUrl` - Get an image from the https://picsum.photos service.
366366
* `PlaceholderUrl` - Get an image from https://placeholder.com service.
367367
* `LoremFlickrUrl` - Get an image from https://loremflickr.com service.
368-
* `LoremPixelUrl` - Creates an image URL with http://lorempixel.com. Note: This service is slow. Consider using PicsumUrl() as a faster alternative.
369-
* `Abstract` - Gets an abstract looking image.
370-
* `Animals` - Gets an image of an animal.
371-
* `Business` - Gets a business looking image.
372-
* `Cats` - Gets a picture of a cat.
373-
* `City` - Gets a city looking image.
374-
* `Food` - Gets an image of food.
375-
* `Nightlife` - Gets an image with city looking nightlife.
376-
* `Fashion` - Gets an image in the fashion category.
377-
* `People` - Gets an image of humans.
378-
* `Nature` - Gets an image of nature.
379-
* `Sports` - Gets an image related to sports.
380-
* `Technics` - Get a technology related image.
381-
* `Transport` - Get a transportation related image.
382368
* **`Internet`**
383369
* `Avatar` - Generates a legit Internet URL avatar from twitter accounts.
384370
* `Email` - Generates an email address.

Source/Bogus.Tests/DataSetTests/ImageTest.cs

+1-22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System.IO;
2-
using System.Net;
32
using Bogus.DataSets;
43
using FluentAssertions;
54
using Xunit;
65
using Xunit.Abstractions;
7-
using static Bogus.DataSets.LoremPixelCategory;
86

97
namespace Bogus.Tests.DataSetTests;
108

@@ -20,25 +18,6 @@ public ImageTest(ITestOutputHelper console)
2018

2119
private readonly Images image;
2220

23-
[Fact(Skip = "Explicit")]
24-
public void DownloadAllTest()
25-
{
26-
var wc = new WebClient();
27-
wc.DownloadFile(image.LoremPixelUrl(Abstract), "abstract.jpg");
28-
wc.DownloadFile(image.LoremPixelUrl(Animals), "animals.jpg");
29-
wc.DownloadFile(image.LoremPixelUrl(Business), "business.jpg");
30-
wc.DownloadFile(image.LoremPixelUrl(Cats), "cats.jpg");
31-
wc.DownloadFile(image.LoremPixelUrl(City), "city.jpg");
32-
wc.DownloadFile(image.LoremPixelUrl(Food), "food.jpg");
33-
wc.DownloadFile(image.LoremPixelUrl(Nightlife), "nightlife.jpg");
34-
wc.DownloadFile(image.LoremPixelUrl(Fashion), "fashion.jpg");
35-
wc.DownloadFile(image.LoremPixelUrl(People), "people.jpg");
36-
wc.DownloadFile(image.LoremPixelUrl(Nature), "nature.jpg");
37-
wc.DownloadFile(image.LoremPixelUrl(Sports), "sports.jpg");
38-
wc.DownloadFile(image.LoremPixelUrl(Technics), "technics.jpg");
39-
wc.DownloadFile(image.LoremPixelUrl(Transport), "transport.jpg");
40-
}
41-
4221
[Fact]
4322
public void svg_data_url()
4423
{
@@ -70,7 +49,7 @@ public void svg_data_url()
7049
[Fact]
7150
public void url_generated_should_have_https()
7251
{
73-
image.LoremPixelUrl(Sports, https: true).Should().StartWith("https://");
52+
image.PicsumUrl().Should().StartWith("https://");
7453
}
7554

7655
[Fact]

Source/Bogus.Tests/GitHubIssues/PullRequest113.cs

-17
This file was deleted.

Source/Bogus/DataSets/Images.LoremPixel.cs

-202
This file was deleted.

Source/Bogus/DataSets/Images.cs

-45
Original file line numberDiff line numberDiff line change
@@ -182,49 +182,4 @@ public string LoremFlickrUrl(
182182

183183
return Url + sb;
184184
}
185-
186-
/// <summary>
187-
/// Creates an image URL with http://lorempixel.com. Note: This service is slow. Consider using PicsumUrl() as a faster alternative.
188-
/// </summary>
189-
public string LoremPixelUrl(string category = LoremPixelCategory.Random, int width = 640, int height = 480, bool randomize = false, bool https = false)
190-
{
191-
if( category == LoremPixelCategory.Random )
192-
{
193-
var categories = new[]
194-
{
195-
LoremPixelCategory.Abstract,
196-
LoremPixelCategory.Animals,
197-
LoremPixelCategory.Business,
198-
LoremPixelCategory.Cats,
199-
LoremPixelCategory.City,
200-
LoremPixelCategory.Food,
201-
LoremPixelCategory.Nightlife,
202-
LoremPixelCategory.Fashion,
203-
LoremPixelCategory.People,
204-
LoremPixelCategory.Nature,
205-
LoremPixelCategory.Sports,
206-
LoremPixelCategory.Technics,
207-
LoremPixelCategory.Transport
208-
};
209-
210-
category = this.Random.ArrayElement(categories);
211-
}
212-
213-
var proto = "http://";
214-
if( https )
215-
{
216-
proto = "https://";
217-
}
218-
var url = $"{proto}lorempixel.com/{width}/{height}";
219-
if( !string.IsNullOrWhiteSpace(category) )
220-
{
221-
url += $"/{category}";
222-
if( randomize )
223-
{
224-
url += $"/{this.Random.Number(1, 10)}";
225-
}
226-
}
227-
228-
return url;
229-
}
230185
}

0 commit comments

Comments
 (0)