Skip to content

Advice about the best NFluent equivalent of FluentAssertions BeEquivalentTo assertion #347

@maximedezette

Description

@maximedezette

Hi NFluent Team,

I've developed a simple tool to help automate the migration from FluentAssertions to NFluent assertions.

While the tool doesn’t yet support every assertion, it significantly eases the migration process by handling most common assertion replacements. It offers a more efficient approach compared to manual search-and-replace techniques.
My goal is to enable migrations of large projects to be completed in just a few hours, leaving only minor adjustments for more complex assertions.

That said, I'm new to NFluent and would greatly appreciate your advice on some of the transformations the tool performs. In particular, I’m uncertain about the replacement for .Should().BeEquivalentTo(object).

Currently, the tool replaces it with:

Check.That(var).HasFieldsWithSameValues(object);

While this works in most cases, it doesn’t fully match the behavior of BeEquivalentTo, which checks the entire object graph and can also be applied to collections. Initially, I considered .IsEquivalentTo(object) as a replacement but encountered more build errors with that approach.

Do you have any suggestions for a better equivalent in NFluent for this specific assertion? I'd be grateful for your insights on improving the tool! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions