fluentassertions / fluentassertions.json

NewtonSoft.Json extensions for FluentAssertions
Apache License 2.0
72 stars 26 forks source link

Support `AssertionsOptions` in `BeEquivalentTo` #59

Closed souhailelk closed 2 years ago

souhailelk commented 2 years ago

Fixes #58

souhailelk commented 2 years ago

@dennisdoomen What do you think of the implementation of IEquivalencyAssertionOptions and the usages? I'll adjust more the code after your review 😊

dennisdoomen commented 2 years ago

I don't get how you ended up with that implementation. What I was trying to convey in all the comments is something like:

actual.Should().BeEquivalentTo(expected, options => options
    .Using<double>(d => d.Subject.Should().BeApproximately(d.Expectation, 0.1))
    .WhenTypeIs<double>()));

Where options is some kind of interface like IJsonAssertionOptions<T> that (for now) only exposes the Using<T> method in the example. This interface is implemented by a type that inherits from EquivalencyAssertionOptions (from FluentAssertions).

souhailelk commented 2 years ago

I don't get how you ended up with that implementation. What I was trying to convey in all the comments is something like:

actual.Should().BeEquivalentTo(expected, options => options
    .Using<double>(d => d.Subject.Should().BeApproximately(d.Expectation, 0.1))
    .WhenTypeIs<double>()));

Where options is some kind of interface like IJsonAssertionOptions<T> that (for now) only exposes the Using<T> method in the example. This interface is implemented by a type that inherits from EquivalencyAssertionOptions (from FluentAssertions).

@dennisdoomen, I tried to implement that in my recent commits. What do you think?

souhailelk commented 2 years ago

@dennisdoomen Thank you for the review. Please, when could you merge the P.R?

jnyrup commented 2 years ago

@dennisdoomen Thank you for the review.

Please, when could you merge the P.R?

When I've also reviewed it. I'll do it one of the following days.

souhailelk commented 2 years ago

@jnyrup could you review my P.R 😊 ?

souhailelk commented 2 years ago

@jnyrup Thanks for the review.

jnyrup commented 2 years ago

@dennisdoomen do you have any last minutes changes that needs to be done before merging?