Skip to content

Conversation

@dennisdoomen
Copy link
Member

@dennisdoomen dennisdoomen commented Apr 24, 2019

Implementations of IAssertionRule (including the usage of Using().WhenTypeIs() were never run for root objects.

Fixes #1032

@dennisdoomen dennisdoomen changed the title [WIP] Allow nesting equivalency checks in custom assertion rules Allow nesting equivalency checks in custom assertion rules Apr 24, 2019
@dennisdoomen dennisdoomen requested a review from jnyrup April 24, 2019 19:21
{
if (step.CanHandle(context, config) && step.Handle(context, parent, config))
{
return true;
Copy link
Member

Choose a reason for hiding this comment

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

👍 Great, eases debugging

public bool CanHandle(IEquivalencyValidationContext context, IEquivalencyAssertionOptions config)
{
return !context.IsRoot;
return true;
Copy link
Member

Choose a reason for hiding this comment

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

❓ I'm not sure what the implications of this change are?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's the real fix. I honestly don't know (or remember) why that condition existed in the first place.

// Act
//-----------------------------------------------------------------------------------------------------------
Action act = () => subject.Should().BeEquivalentTo(expectation, options => options
.Using<ClassWithSomeFieldsAndProperties>(ctx => ctx.Subject.Should().BeEquivalentTo(ctx.Expectation, nestedOptions=> nestedOptions.Excluding(x => x.Property2)))
Copy link
Member

Choose a reason for hiding this comment

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

🙃 Missing whitespace in nestedOptions=>

@dennisdoomen dennisdoomen merged commit 4a56bb4 into fluentassertions:master Apr 25, 2019
@dennisdoomen dennisdoomen deleted the Fix1032 branch April 25, 2019 18:18
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.

AssertionOptions ignored for single items

2 participants