Class Is
Helper class with properties and methods that supply
a number of constraints used in Asserts.
Assembly: nunit.framework.dll
Syntax
Constructors
View Source
Is()
Declaration
Properties
View Source
All
Returns a ConstraintExpression, which will apply
the following constraint to all members of a collection,
succeeding if all of them succeed.
Declaration
public static ConstraintExpression All { get; }
Property Value
View Source
Default
Returns a constraint that tests for default value
Declaration
public static DefaultConstraint Default { get; }
Property Value
View Source
Empty
Returns a constraint that tests for empty
Declaration
public static EmptyConstraint Empty { get; }
Property Value
View Source
False
Returns a constraint that tests for False
Declaration
public static FalseConstraint False { get; }
Property Value
View Source
NaN
Returns a constraint that tests for NaN
Declaration
public static NaNConstraint NaN { get; }
Property Value
View Source
Negative
Returns a constraint that tests for a negative value
Declaration
public static LessThanConstraint Negative { get; }
Property Value
View Source
Not
Returns a ConstraintExpression that negates any
following constraint.
Declaration
public static ConstraintExpression Not { get; }
Property Value
View Source
Null
Returns a constraint that tests for null
Declaration
public static NullConstraint Null { get; }
Property Value
View Source
Ordered
Returns a constraint that tests whether a collection is ordered
Declaration
public static CollectionOrderedConstraint Ordered { get; }
Property Value
View Source
Positive
Returns a constraint that tests for a positive value
Declaration
public static GreaterThanConstraint Positive { get; }
Property Value
View Source
True
Returns a constraint that tests for True
Declaration
public static TrueConstraint True { get; }
Property Value
View Source
Unique
Returns a constraint that tests whether a collection
contains all unique items.
Declaration
public static UniqueItemsConstraint Unique { get; }
Property Value
View Source
WhiteSpace
Returns a constraint that tests for white-space
Declaration
public static WhiteSpaceConstraint WhiteSpace { get; }
Property Value
View Source
XmlSerializable
Returns a constraint that tests whether an object graph is serializable in XML format.
Declaration
public static XmlSerializableConstraint XmlSerializable { get; }
Property Value
View Source
Zero
Returns a constraint that tests for equality with zero
Declaration
public static EqualConstraint Zero { get; }
Property Value
Methods
View Source
AnyOf(ICollection)
Returns a constraint that tests if an item is equal to any of parameters
Declaration
public static AnyOfConstraint AnyOf(ICollection expected)
Parameters
Type |
Name |
Description |
ICollection |
expected |
Expected values
|
Returns
View Source
AnyOf(params object?[]?)
Returns a constraint that tests if an item is equal to any of parameters
Declaration
public static AnyOfConstraint AnyOf(params object?[]? expected)
Parameters
Type |
Name |
Description |
object[] |
expected |
Expected values
|
Returns
View Source
AssignableFrom(Type)
Returns a constraint that tests whether the actual value
is assignable from the type supplied as an argument.
Declaration
public static AssignableFromConstraint AssignableFrom(Type expectedType)
Parameters
Type |
Name |
Description |
Type |
expectedType |
|
Returns
View Source
AssignableFrom<TExpected>()
Returns a constraint that tests whether the actual value
is assignable from the type supplied as an argument.
Declaration
public static AssignableFromConstraint AssignableFrom<TExpected>()
Returns
Type Parameters
Name |
Description |
TExpected |
|
View Source
AssignableTo(Type)
Returns a constraint that tests whether the actual value
is assignable to the type supplied as an argument.
Declaration
public static AssignableToConstraint AssignableTo(Type expectedType)
Parameters
Type |
Name |
Description |
Type |
expectedType |
|
Returns
View Source
AssignableTo<TExpected>()
Returns a constraint that tests whether the actual value
is assignable to the type supplied as an argument.
Declaration
public static AssignableToConstraint AssignableTo<TExpected>()
Returns
Type Parameters
Name |
Description |
TExpected |
|
View Source
AtLeast(object)
Returns a constraint that tests whether the
actual value is greater than or equal to the supplied argument
Declaration
public static GreaterThanOrEqualConstraint AtLeast(object expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
AtMost(object)
Returns a constraint that tests whether the
actual value is less than or equal to the supplied argument
Declaration
public static LessThanOrEqualConstraint AtMost(object expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
EqualTo(object?)
Returns a constraint that tests two items for equality
Declaration
public static EqualConstraint EqualTo(object? expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
EquivalentTo(IEnumerable)
Returns a constraint that tests whether the actual value
is a collection containing the same elements as the
collection supplied as an argument.
Declaration
public static CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
Parameters
Returns
View Source
GreaterThan(object)
Returns a constraint that tests whether the
actual value is greater than the supplied argument
Declaration
public static GreaterThanConstraint GreaterThan(object expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
GreaterThanOrEqualTo(object)
Returns a constraint that tests whether the
actual value is greater than or equal to the supplied argument
Declaration
public static GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
InRange(object, object)
Returns a constraint that tests whether the actual value falls
inclusively within a specified range.
Declaration
public static RangeConstraint InRange(object from, object to)
Parameters
Type |
Name |
Description |
object |
from |
Inclusive beginning of the range.
|
object |
to |
Inclusive end of the range.
|
Returns
View Source
InstanceOf(Type)
Returns a constraint that tests whether the actual value
is of the type supplied as an argument or a derived type.
Declaration
public static InstanceOfTypeConstraint InstanceOf(Type expectedType)
Parameters
Type |
Name |
Description |
Type |
expectedType |
|
Returns
View Source
InstanceOf<TExpected>()
Returns a constraint that tests whether the actual value
is of the type supplied as an argument or a derived type.
Declaration
public static InstanceOfTypeConstraint InstanceOf<TExpected>()
Returns
Type Parameters
Name |
Description |
TExpected |
|
View Source
LessThan(object)
Returns a constraint that tests whether the
actual value is less than the supplied argument
Declaration
public static LessThanConstraint LessThan(object expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
LessThanOrEqualTo(object)
Returns a constraint that tests whether the
actual value is less than or equal to the supplied argument
Declaration
public static LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
SameAs(object?)
Returns a constraint that tests that two references are the same object
Declaration
public static SameAsConstraint SameAs(object? expected)
Parameters
Type |
Name |
Description |
object |
expected |
|
Returns
View Source
SamePath(string)
Returns a constraint that tests whether the path provided
is the same as an expected path after canonicalization.
Declaration
public static SamePathConstraint SamePath(string expected)
Parameters
Type |
Name |
Description |
string |
expected |
|
Returns
View Source
SamePathOrUnder(string)
Returns a constraint that tests whether the path provided
is the same path or under an expected path after canonicalization.
Declaration
public static SamePathOrUnderConstraint SamePathOrUnder(string expected)
Parameters
Type |
Name |
Description |
string |
expected |
|
Returns
View Source
SubPathOf(string)
Returns a constraint that tests whether the path provided
is a subpath of the expected path after canonicalization.
Declaration
public static SubPathConstraint SubPathOf(string expected)
Parameters
Type |
Name |
Description |
string |
expected |
|
Returns
View Source
SubsetOf(IEnumerable)
Returns a constraint that tests whether the actual value
is a subset of the collection supplied as an argument.
Declaration
public static CollectionSubsetConstraint SubsetOf(IEnumerable expected)
Parameters
Returns
View Source
SupersetOf(IEnumerable)
Returns a constraint that tests whether the actual value
is a superset of the collection supplied as an argument.
Declaration
public static CollectionSupersetConstraint SupersetOf(IEnumerable expected)
Parameters
Returns
View Source
TypeOf(Type)
Returns a constraint that tests whether the actual
value is of the exact type supplied as an argument.
Declaration
public static ExactTypeConstraint TypeOf(Type expectedType)
Parameters
Type |
Name |
Description |
Type |
expectedType |
|
Returns
View Source
TypeOf<TExpected>()
Returns a constraint that tests whether the actual
value is of the exact type supplied as an argument.
Declaration
public static ExactTypeConstraint TypeOf<TExpected>()
Returns
Type Parameters
Name |
Description |
TExpected |
|