Class TypeAsserts
- Namespace
- Asserts
- Assembly
- xunit.v3.assert.dll
public class TypeAsserts
- Inheritance
-
TypeAsserts
- Inherited Members
Methods
IsAssignableFrom(Type, object?)
Verifies that an object is of the given type or a derived type.
public static void IsAssignableFrom(Type expectedType, object? @object)
Parameters
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsAssignableFromException
Thrown when the object is not the given type
IsAssignableFrom<T>(object?)
Verifies that an object is of the given type or a derived type.
public static T IsAssignableFrom<T>(object? @object)
Parameters
objectobjectThe object to be evaluated
Returns
- T
The object, casted to type T when successful
Type Parameters
TThe type the object should be
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsAssignableFromException
Thrown when the object is not the given type
IsNotAssignableFrom(Type, object?)
Verifies that an object is not of the given type or a derived type.
public static void IsNotAssignableFrom(Type expectedType, object? @object)
Parameters
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsNotAssignableFromException
Thrown when the object is of the given type
IsNotAssignableFrom<T>(object?)
Verifies that an object is not of the given type or a derived type.
public static void IsNotAssignableFrom<T>(object? @object)
Parameters
objectobjectThe object to be evaluated
Type Parameters
TThe type the object should not be
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsNotAssignableFromException
Thrown when the object is of the given type
IsNotType(Type, object?)
Verifies that an object is not exactly the given type.
public static void IsNotType(Type expectedType, object? @object)
Parameters
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsNotTypeException
Thrown when the object is the given type
IsNotType(Type, object?, bool)
Verifies that an object is not of the given type.
public static void IsNotType(Type expectedType, object? @object, bool exactMatch)
Parameters
expectedTypeTypeThe type the object should not be
objectobjectThe object to be evaluated
exactMatchboolWill only fail with an exact type match when
trueis passed; will fail with a compatible type match whenfalseis passed.
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsNotTypeException
Thrown when the object is the given type
IsNotType<T>(object?)
Verifies that an object is not exactly the given type.
public static void IsNotType<T>(object? @object)
Parameters
objectobjectThe object to be evaluated
Type Parameters
TThe type the object should not be
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsNotTypeException
Thrown when the object is the given type
IsNotType<T>(object?, bool)
Verifies that an object is not of the given type.
public static void IsNotType<T>(object? @object, bool exactMatch)
Parameters
objectobjectThe object to be evaluated
exactMatchboolWill only fail with an exact type match when
trueis passed; will fail with a compatible type match whenfalseis passed.
Type Parameters
TThe type the object should not be
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsNotTypeException
Thrown when the object is the given type
IsType(Type, object?)
Verifies that an object is exactly the given type (and not a derived type).
public static void IsType(Type expectedType, object? @object)
Parameters
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsTypeException
Thrown when the object is not the given type
IsType(Type, object?, bool)
Verifies that an object is of the given type.
public static void IsType(Type expectedType, object? @object, bool exactMatch)
Parameters
expectedTypeTypeThe type the object should be
objectobjectThe object to be evaluated
exactMatchboolWill only pass with an exact type match when
trueis passed; will pass with a compatible type match whenfalseis passed.
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsTypeException
Thrown when the object is not the given type
IsType<T>(object?)
Verifies that an object is exactly the given type (and not a derived type).
public static T IsType<T>(object? @object)
Parameters
objectobjectThe object to be evaluated
Returns
- T
The object, casted to type T when successful
Type Parameters
TThe type the object should be
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsTypeException
Thrown when the object is not the given type
IsType<T>(object?, bool)
Verifies that an object of is the given type.
public static T IsType<T>(object? @object, bool exactMatch)
Parameters
objectobjectThe object to be evaluated
exactMatchboolWill only pass with an exact type match when
trueis passed; will pass with a compatible type match whenfalseis passed.
Returns
- T
The object, casted to type T when successful
Type Parameters
TThe type the object should be
Examples
Add an example for this method ?
Contribution guide.
Exceptions
- IsTypeException
Thrown when the object is not the given type