Skip to content

[Feature]: Make IsAssignableTo behave like IsTypeOf and return the typed value #6184

@AdrianoAE

Description

@AdrianoAE

Problem Statement

IsTypeOf returnss the typed value

IEnumerable<MyDto> returnedData = (await Assert.That(okResult.Value).IsTypeOf<IEnumerable<MyDto>>())!;

But the IsAssignableTo returns object instead of the typed value requiring 2 steps

await Assert.That(okResult.Value).IsAssignableTo<IEnumerable<MyDto>>();
IEnumerable<MyDto> returnedData = (IEnumerable<MyDto>)okResult.Value!;

Proposed Solution

return the typed value casted to the specified type.

Would also be good if in general would be possible to handle the nullability without requiring (await Assertion)! like the IsNotNull

Feature Category

Assertion

How important is this feature to you?

QoL

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions