Skip to content

Commit

Permalink
Refactor reorder. Refresh doc page. Prep release.
Browse files Browse the repository at this point in the history
  • Loading branch information
bchavez committed Oct 15, 2019
1 parent 15453a7 commit 71b26ea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ public void Using_FakerT_Inheritance()
* **`Images`**
* `DataUri` - Get a SVG data URI image with a specific width and height.
* `PicsumUrl` - Get an image from the https://picsum.photos service.
* `PlaceholderUrl` - Get an image from https://placeholder.com service.
* `LoremFlickrUrl` - Get an image from https://loremflickr.com service.
* `LoremPixelUrl` - Creates an image URL with http://lorempixel.com. Note: This service is slow. Consider using PicsumUrl() as a faster alternative.
* `Abstract` - Gets an abstract looking image.
Expand All @@ -356,21 +357,27 @@ public void Using_FakerT_Inheritance()
* `Email` - Generates an email address.
* `ExampleEmail` - Generates an example email with @example.com.
* `UserName` - Generates user names.
* `UserNameUnicode` - Generates a user name preserving Unicode characters.
* `DomainName` - Generates a random domain name.
* `DomainWord` - Generates a domain word used for domain names.
* `DomainSuffix` - Generates a domain name suffix like .com, .net, .org
* `Ip` - Gets a random IP address.
* `Ipv6` - Generates a random IPv6 address.
* `Ip` - Gets a random IPv4 address string.
* `IpAddress` - Gets a random IPv4 IPAddress type.
* `IpEndPoint` - Gets a random IPv4 IPEndPoint.
* `Ipv6` - Generates a random IPv6 address string.
* `Ipv6Address` - Generate a random IPv6 IPAddress type.
* `Ipv6EndPoint` - Gets a random IPv6 IPEndPoint.
* `UserAgent` - Generates a random user agent.
* `Mac` - Gets a random mac address.
* `Password` - Generates a random password.
* `Color` - Gets a random aesthetically pleasing color near the base RGB. See [here](http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette).
* `Protocol` - Returns a random protocol. HTTP or HTTPS.
* `Url` - Generates a random URL.
* `UrlWithPath` - Get a random URL with random path.
* `UrlWithPath` - Get an absolute URL with random path.
* `UrlRootedPath` - Get a rooted URL path like: /foo/bar. Optionally with file extension.
* **`Lorem`**
* `Word` - Get a random lorem word.
* `Words` - Get some lorem words
* `Words` - Get an array of random lorem words.
* `Letter` - Get a character letter.
* `Sentence` - Get a random sentence of specific number of words.
* `Sentences` - Get some sentences.
Expand Down Expand Up @@ -400,6 +407,7 @@ public void Using_FakerT_Inheritance()
* `FileName` - Get a random file name.
* `DirectoryPath` - Get a random directory path (Unix).
* `FilePath` - Get a random file path (Unix).
* `CommonFileName` - Generates a random file name with a common file extension.
* `MimeType` - Get a random mime type
* `CommonFileType` - Returns a commonly used file type.
* `CommonFileExt` - Returns a commonly used file extension.
Expand Down
34 changes: 19 additions & 15 deletions Source/Bogus/DataSets/Internet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@ public string DomainSuffix()
}

/// <summary>
/// Gets a random IP address string.
/// Gets a random IPv4 address string.
/// </summary>
/// <returns>A random IP address.</returns>
/// <returns>A random IPv4 address.</returns>
public string Ip()
{
return $"{Random.Number(1, 255)}.{Random.Number(255)}.{Random.Number(255)}.{Random.Number(255)}";
}

/// <summary>
/// Gets a random IPAddress type.
/// Gets a random IPv4 IPAddress type.
/// </summary>
public IPAddress IpAddress()
{
Expand All @@ -168,7 +168,18 @@ public IPAddress IpAddress()
}

/// <summary>
/// Generates a random IPv6 address.
/// Gets a random IPv4 IPEndPoint.
/// </summary>
/// <returns>A random IPv4 IPEndPoint.</returns>
public IPEndPoint IpEndPoint()
{
var address = this.IpAddress();
var port = this.Random.Int(IPEndPoint.MinPort + 1, IPEndPoint.MaxPort);
return new IPEndPoint(address, port);
}

/// <summary>
/// Generates a random IPv6 address string.
/// </summary>
/// <returns>A random IPv6 address.</returns>
public string Ipv6()
Expand All @@ -178,23 +189,16 @@ public string Ipv6()
$"{bytes[0]:x}{bytes[1]:x}:{bytes[2]:x}{bytes[3]:x}:{bytes[4]:x}{bytes[5]:x}:{bytes[6]:x}{bytes[7]:x}:{bytes[8]:x}{bytes[9]:x}:{bytes[10]:x}{bytes[11]:x}:{bytes[12]:x}{bytes[13]:x}:{bytes[14]:x}{bytes[15]:x}";
}

/// <summary>
/// Generate a random IPv6 IPAddress type.
/// </summary>
/// <returns></returns>
public IPAddress Ipv6Address()
{
var address = new IPAddress(this.Random.Bytes(16));
return address;
}

/// <summary>
/// Gets a random IPv4 IPEndPoint.
/// </summary>
/// <returns>A random IPv4 IPEndPoint.</returns>
public IPEndPoint IpEndPoint()
{
var address = this.IpAddress();
var port = this.Random.Int(IPEndPoint.MinPort + 1, IPEndPoint.MaxPort);
return new IPEndPoint(address, port);
}

/// <summary>
/// Gets a random IPv6 IPEndPoint.
/// </summary>
Expand Down

0 comments on commit 71b26ea

Please sign in to comment.