Interface IDefensiveGuardable
This interface provides methods for defensive or basic guard clauses. The implementation of these methods should fail, if they approve the statement of the method name.
Namespace: TeleScope.GuardClauses.Abstractions
Assembly: TeleScope.GuardClauses.dll
Syntax
public interface IDefensiveGuardable
Methods
| Improve this Doc View SourceEquality<T>(T, T, String, String)
The implementation shall check the input against an equal comparator and fail, if both instances are equal.
Declaration
T Equality<T>(T input, T comparator, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
T | input | The instance under test. |
T | comparator | The instance that shall be compared by an implementation of the method. |
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 |
---|---|
T | The input data, if no exception will be thrown. |
Type Parameters
Name | Description |
---|---|
T | The type param under test. |
False(Boolean, String, String)
The implementation shall check the boolean input against False
and fail, if that is the case.
Declaration
bool False(bool input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | 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.Boolean | The input data, if no exception will be thrown. |
Null<T>(T, String, String)
The implementation shall check the input against null and fail, if that is the case.
Declaration
T Null<T>(T input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
T | 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 |
---|---|
T | The input data, if no exception will be thrown. |
Type Parameters
Name | Description |
---|---|
T | The type param under test. |
True(Boolean, String, String)
The implementation shall check the boolean input against True
and fail, if that is the case.
Declaration
bool True(bool input, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | 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.Boolean | The input data, if no exception will be thrown. |
Unequality<T>(T, T, String, String)
The implementation shall check the input against an unequal comparator and fail, if both instances are unequal.
Declaration
T Unequality<T>(T input, T comparator, string expression = null, string message = null)
Parameters
Type | Name | Description |
---|---|---|
T | input | The instance under test. |
T | comparator | The instance that shall be compared by an implementation of the method. |
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 |
---|---|
T | The input data, if no exception will be thrown. |
Type Parameters
Name | Description |
---|---|
T | The type param under test. |