Skip to content

BeEquivalentTo shows enums as decimal in error message #897

@robvanuden

Description

@robvanuden

Description

BeEquivalentTo shows enums as decimal in error message

public enum Color
{
    Red,Blue
}

Expected member Color to be 1M, but found 0M.

Complete minimal example reproducing the issue

public enum Color
{
    Red,Blue
}

public class Car
{
    public Color Color { get; set; }
}

[Fact]
public void Test()
{
    var car = new Car
    {
        Color = Color.Red
    };
    car.Should().BeEquivalentTo(new Car() { Color = Color.Blue });
}

Expected behavior:

Message: Expected member Color to be Blue, but found Red.

Actual behavior:

Message: Expected member Color to be 1M, but found 0M.

Versions

  • FluentAssertions 5.4.1
  • .NET Core 2.0

Additional Information

Running in Xunit, when relevant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions