Class Contract
Asserts conditions and throws exceptions.
Inherited Members
Namespace: Automata.Core
Assembly: Automata.Core.dll
Syntax
public static class Contract
Methods
| Edit this page View SourceShouldBeGreaterThanOrEqual(int, int, string)
Asserts value is greater than or equal to other.
Declaration
public static int ShouldBeGreaterThanOrEqual(this int value, int other, string paramName = "")
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | Value to validate. |
| int | other | Value to compare against. |
| string | paramName | Captured automatically. |
Returns
| Type | Description |
|---|---|
| int |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown |
ShouldBeInRange(int, Range, string)
Asserts value is within range.
Declaration
public static int ShouldBeInRange(this int value, Range range, string paramName = "")
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | Value to validate. |
| Range | range | Valid range (end-exclusive). |
| string | paramName | Captured automatically. |
Returns
| Type | Description |
|---|---|
| int |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown |
ShouldNotBeNegative(int, string)
Asserts value is not negative.
Declaration
public static int ShouldNotBeNegative(this int value, string paramName = "")
Parameters
| Type | Name | Description |
|---|---|---|
| int | value | Value to validate. |
| string | paramName | Captured automatically. |
Returns
| Type | Description |
|---|---|
| int |
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | Thrown |