Skip to content

Using fluent syntax unintentionally removed in 3.8 #2412

Closed
@ChrisMaddock

Description

@ChrisMaddock

From @BlythMeister on #2410
with regard to the example code, we had
Assert.That(myCollection, Contains.Item(expectedItem).Using(new MyCustomComparer()));
The .Using fluent method existed in 3.7, but was removed in 3.8.
I was unable to find an equivalent, so changed to
Assert.That(myCollection.Contains(expectedItem, new MyCustomComparer()));
Which was a simple enough change as a 1 off, but we had around 100 usages of that old syntax with different collection names, expected names as comparers (across different projects)

This change was unintentional - the removal of CollectionContainsConstraint wasn't intended to cause any breaking changes.

@mikkelbu did the below analysis of what happened:

@BlythMeister This is very unfortunate. Actually, @ChrisMaddock spotted the missing Using in aa19bd1 (see #2239 (comment)), so we added Using to the EqualConstraint in bd2091b. However, the entire PR did contain an error, so Contains.Item was again changed in 15c27e5 to return a ContainsConstraint instead of a EqualConstraint. And currently ContainsConstraint does not have a Using method.

@rprouse - will leave you to decide if this should be critical or not, possibly along with #2411 - I haven't looked into that one.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions