Interface IStringGuardable
This interface provides methods for string related guard clauses. The implementation of these methods should succeed, if they approve the statement of the method name.
Namespace: TeleScope.GuardClauses.Abstractions
Assembly: TeleScope.GuardClauses.dll
Syntax
public interface IStringGuardable
Methods
| Improve this Doc View SourceIsIpAddress(String, InternetProtocols, String, String)
The implementation shall check, if the input string is a valid IP address.
Declaration
string IsIpAddress(string input, InternetProtocols protocol = InternetProtocols.IPv4, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
InternetProtocols | protocol | The protocol version that needs to match during the guard precedure. The default value is IPv4. |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
System.String | The input data, if no exception will be thrown. |
IsMailAddress(String, String, String)
The implementation shall check, if the input string is a valid email address.
Declaration
string IsMailAddress(string input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
System.String | The input data, if no exception will be thrown. |
IsNotNullOrEmpty(String, String, String)
The implementation shall check, if the input string is Null or an empty string.
Declaration
string IsNotNullOrEmpty(string input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
System.String | The input data, if no exception will be thrown. |
IsNotNullOrWhiteSpace(String, String, String)
The implementation shall check, if the input string is Null or a whitespace.
Declaration
string IsNotNullOrWhiteSpace(string input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
System.String | The input data, if no exception will be thrown. |
IsUri(String, UriKind, String, String)
The implementation shall check, if the input string is a valid Uri.
Declaration
string IsUri(string input, UriKind kind = null, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
UriKind | kind | The uri kind. The default value is |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
System.String | The input data, if no exception will be thrown. |
IsWebUri(String, String, String)
The implementation shall check, if the input string is a valid Uri.
Declaration
string IsWebUri(string input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
System.String | The input data, if no exception will be thrown. |
ToMailAddress(String, String, String)
The implementation shall check, if the input string is a valid email address.
Declaration
MailAddress ToMailAddress(string input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
MailAddress | The input data as |
ToUri(String, String, String)
The implementation shall check, if the input string is a valid Uri and
shall convert the value into an
Declaration
Uri ToUri(string input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The instance under test. |
System.String | expression | The optional parameter name under test. |
System.String | message | The optional exception message that wil be used, if the method implementation throws. |
Returns
Type | Description |
---|---|
Uri | The input data as |