Skip to content

null ShouldBeAssignable to Nullable<> types #978

@CorwinDickey

Description

@CorwinDickey

This seems to be related to #427

Currently using version 4.2.1

I run into the same issue when trying to run the assertion on nullable types, specifically I ran into it for int? and decimal?.

int? value = null;
value.ShouldBeAssignableTo<int?>();
decimal? value = null;
value.ShouldBeAssignableTo<decimal?>();

Both of those situations result in this message for their respective type:

Message: Shouldly.ShouldAssertException : value
    should be assignable to
System.Nullable`1[System.Decimal]
    but was
null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions