Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 7, 2025

Documentation incorrectly referenced a .IgnoringOrder() method that doesn't exist. Issue also asked whether global configuration for CollectionOrdering default behavior would be useful.

Changes

Documentation fixes (collections.md):

  • Removed non-existent .IgnoringOrder() method reference
  • Clarified that order is ignored by default - no method call needed
  • Added explicit CollectionOrdering.Matching examples for order-sensitive comparisons
  • Added "Practical Tips for Collection Ordering" section covering common scenarios

Documentation consistency (troubleshooting.md):

  • Updated to show CollectionOrdering.Matching as the correct approach for ordered comparisons

Behavior (unchanged)

// Default: order ignored
await Assert.That(new[] { 1, 2, 3 }).IsEquivalentTo(new[] { 3, 2, 1 });  // ✅ Passes

// Explicit: order must match
await Assert.That(new[] { 1, 2, 3 })
    .IsEquivalentTo(new[] { 1, 2, 3 }, CollectionOrdering.Matching);  // ✅ Passes

await Assert.That(new[] { 1, 2, 3 })
    .IsEquivalentTo(new[] { 3, 2, 1 }, CollectionOrdering.Matching);  // ❌ Fails

Decision: No global configuration

Explicit CollectionOrdering parameter maintains clarity and follows industry patterns (NUnit, xUnit, MSTest). Default behavior (order-agnostic) is correct for most use cases.

Original prompt

This section details on the original issue you should resolve

<issue_title>IsEquivalentTo default behavior + docs</issue_title>
<issue_description>Regarding the docs for IsEquivalentTo()

IgnoringOrder() does not seem to exist (which makes sense given that order is ignored by default).

Might it be useful if the default behaviour could be configured globally, rather than having to supply the CollectionOrdering parameter each time?</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update IsEquivalentTo behavior and documentation Fix IsEquivalentTo documentation - remove non-existent IgnoringOrder method Nov 7, 2025
Copilot AI requested a review from thomhurst November 7, 2025 12:39
Copilot finished work on behalf of thomhurst November 7, 2025 12:39
@thomhurst thomhurst marked this pull request as ready for review November 7, 2025 12:40
@thomhurst thomhurst merged commit 88eaf05 into main Nov 7, 2025
5 checks passed
@thomhurst thomhurst deleted the copilot/update-is-equivalent-to-default branch November 7, 2025 12:40
This was referenced Nov 10, 2025
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.

IsEquivalentTo default behavior + docs

2 participants