Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve BeEquivalentTo error messages #34

Conversation

ronaldkroon
Copy link
Contributor

  • Changed sentence to avoid confusion of actual document after "Expected"
  • Mention actual type and length differences in message

Changed sentence to avoid confusion of _actual_ document after "Expected"
}

internal class Difference
{
public Difference(DifferenceKind kind, JPath path, object actual, object expected) : this(kind, path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't actual and expected be of type string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also passing ints. This way I don't have to call ToString.

var actual = (actualJson != null) ? JToken.Parse(actualJson) : null;
var expected = (expectedJson != null) ? JToken.Parse(expectedJson) : null;
[Theory, MemberData(nameof(FailingBeEquivalentCases))]
public void When_objects_differ_BeEquivalentTo_should_fail(string actualJson, string expectedJson,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather then referring to the name of the method, I suggest to rewrite it as When_json_fragements_are_not_equivalent_it_should_throw

Mention actual type and length differences in message
@ronaldkroon ronaldkroon force-pushed the Improve_BeEquivalentTo_error_messages branch from cf885c9 to f7dfdf9 Compare February 10, 2020 19:35
@dennisdoomen dennisdoomen merged commit bcacab8 into fluentassertions:master Feb 11, 2020
@dennisdoomen
Copy link
Member

Released as 5.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants