Skip to content

Comparing enum and int #1204

@jnyrup

Description

@jnyrup

Description

Before #1202 we had an asymmetry in how we compared an enum and an int, as it worked in one direction, but not the other.

enum MyEnum
{
    One = 1
}

[Fact]
public void when_comparing_an_enum_to_a_numeric_it_should_TODO()
{
    MyEnum.One.As<object>().Should().Be(1);
	// passes
}

[Fact]
public void when_comparing_a_numeric_to_an_enum_it_should_TODO()
{
    1.As<object>().Should().Be(MyEnum.One);
	// fails
}

After #1202, none of them passes.
There were no tests covering these cases.
Should we allow comparing enums with numeric types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions