Skip to content

Conversation

@Falco20019
Copy link
Contributor

Fixes #4670

The implementation of #3486 did not combine the the key and value checks, which lead to issues when combining with And or Or. This PR adds the InsteadOperator with high precedence which allows to replace the DictionaryContainsKeyConstraint with the DictionaryContainsKeyValuePairConstraint since there is no other nice way to replace an entry on the ConstraintStack that would also work with correct precedence.

I initially tried to use the AndOperator, but this would fail in Does.Not cases as the NotOperator would apply to the key-check before the AND would be applied.

I also tried using Contraint.With (which is currently an alias for And and NOT using WithOperator). But that would also only bind the key on the right side and adds the value afterwards.

Copy link
Member

@OsirisTerje OsirisTerje left a comment

Choose a reason for hiding this comment

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

LGTM

@OsirisTerje OsirisTerje merged commit 0d3c43c into nunit:master Mar 25, 2024
@OsirisTerje
Copy link
Member

@Falco20019 Really appreciate the fast response ! Awesome work!

@Falco20019 Falco20019 deleted the bugfix/fix-4670 branch March 26, 2024 08:13
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.

.ContainKey().WithValue() and .Or/.And interact incorrectly

2 participants