Replace Assert.IsTrue with CollectionAssert.AreEqual for collection comparisons#1730
Open
Replace Assert.IsTrue with CollectionAssert.AreEqual for collection comparisons#1730
Conversation
Replace Assert.IsTrue(xxx.IsEqualTo(yyy)) and Assert.IsTrue(xxx.SequenceEqual(yyy)) with CollectionAssert.AreEqual(expected, actual) across 55 test files Co-authored-by: Rob-Hague <5132141+Rob-Hague@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor collection assertions to use CollectionAssert.AreEqual
Replace Assert.IsTrue with CollectionAssert.AreEqual for collection comparisons
Nov 4, 2025
Copilot stopped work on behalf of
Rob-Hague due to an error
November 4, 2025 07:54
Rob-Hague
reviewed
Nov 13, 2025
test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyTest.cs
Outdated
Show resolved
Hide resolved
test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeInitMessageTest.cs
Outdated
Show resolved
Hide resolved
…y using directives - Fixed argument order in KeyExchangeDhGroupExchangeReplyTest.cs (expected first, actual second) - Fixed argument order in KeyExchangeInitMessageTest.cs (expected first, actual second) - Removed unnecessary 'using System.Linq' directives from all affected test files Co-authored-by: Rob-Hague <5132141+Rob-Hague@users.noreply.github.com>
Contributor
Author
Fixed in commit 2821526. All IDE0005 warnings have been resolved by removing unnecessary using directives, and the argument order issues in the review comments have been corrected. The build now succeeds with 0 warnings and 0 errors. |
Rob-Hague
approved these changes
Nov 13, 2025
Collaborator
|
@copilot resolve conflicts |
Contributor
Author
…-collection-assertions # Conflicts: # test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs # test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs
8e5e1bd to
b8a5836
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace collection equality assertions with CollectionAssert.AreEqual
Summary
Successfully refactored 96 collection equality assertions across 55 test files:
Assert.IsTrue(xxx.IsEqualTo(yyy))withCollectionAssert.AreEqual(expected, actual)Assert.IsTrue(xxx.SequenceEqual(yyy))withCollectionAssert.AreEqual(expected, actual)using System.LinqdirectivesChanges from review feedback
Merge conflicts resolved
Merged with develop branch and resolved conflicts in:
ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.csShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.csConflict resolution strategy:
Assert.HasCountfrom develop (new API for checking collection length)CollectionAssert.AreEqualfor collection comparisons (our refactoring goal)Original prompt
💡 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.