Skip to content

DictionaryContainsKeyConstraint no longer derives from CollectionItemsEqualConstraint - #4989

Merged
manfred-brands merged 2 commits into
mainfrom
Issue4981-ContainsKey
May 30, 2025
Merged

manfred-brands merged 2 commits into
mainfrom
Issue4981-ContainsKey

Conversation

@manfred-brands

Copy link
Copy Markdown
Member

Fixes #4981

Now we no longer get IgnoreCase etc., options that don't work.
It hasn't used that functionality for 6+ years.

manfred-brands and others added 2 commits May 27, 2025 17:49
…sEqualConstraint

Now we no longer get `IgnoreCase` options that don't work.

It hasn't used that functionality for 6+ years.

@mikkelbu mikkelbu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good and as far as I can tell the class is covered by tests, so I think this is a fine fix

/// contains an expected object as a key.
/// </summary>
public class DictionaryContainsKeyConstraint : CollectionItemsEqualConstraint
public class DictionaryContainsKeyConstraint : Constraint

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess we need an update to the docs as it has DictionaryContainsKeyConstraint under Collection Constraints in https://github.com/nunit/docs/blob/a844b0a9592a49f29e3a5bfb3a0083f375b29790/docs/articles/nunit/writing-tests/constraints/Constraints.md?plain=1#L85

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is still a constraint on the collection of keys, it just doesn't derive from the class CollectionConstraint anymore.
That note only shows category not class. So I think that part is fine.

I will create a PR to update DictionaryContainsKeyConstraint.md to remove the no longer available constraints.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@manfred-brands
manfred-brands merged commit 43fecd7 into main May 30, 2025
@manfred-brands
manfred-brands deleted the Issue4981-ContainsKey branch May 30, 2025 02:03
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.

ContainsKey doesn't support IgnoreCase, IgnoreWhiteSpace, or IgnoreLineEndingFormat

3 participants