Table of Contents

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

expectedType Type

The type the object should be

object object

The object to be evaluated

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

object object

The object to be evaluated

Returns

T

The object, casted to type T when successful

Type Parameters

T

The 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

expectedType Type

The type the object should not be

object object

The object to be evaluated

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

object object

The object to be evaluated

Type Parameters

T

The 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

expectedType Type

The type the object should not be

object object

The object to be evaluated

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

expectedType Type

The type the object should not be

object object

The object to be evaluated

exactMatch bool

Will only fail with an exact type match when true is passed; will fail with a compatible type match when false is 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

object object

The object to be evaluated

Type Parameters

T

The 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

object object

The object to be evaluated

exactMatch bool

Will only fail with an exact type match when true is passed; will fail with a compatible type match when false is passed.

Type Parameters

T

The 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

expectedType Type

The type the object should be

object object

The object to be evaluated

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

expectedType Type

The type the object should be

object object

The object to be evaluated

exactMatch bool

Will only pass with an exact type match when true is passed; will pass with a compatible type match when false is 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

object object

The object to be evaluated

Returns

T

The object, casted to type T when successful

Type Parameters

T

The 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

object object

The object to be evaluated

exactMatch bool

Will only pass with an exact type match when true is passed; will pass with a compatible type match when false is passed.

Returns

T

The object, casted to type T when successful

Type Parameters

T

The 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