Improve test assertions for clearer failure messages and MSTest 4.x compatibility#292
Merged
samsmithnz merged 3 commits intomainfrom Dec 4, 2025
Merged
Conversation
Pull Request Test Coverage Report for Build 19936417426Details
💛 - Coveralls |
- Replace Assert.IsTrue with Assert.AreEqual for clearer failure messages - Rename test methods for clarity (ACUS -> AmericanCup, 1CubicCM -> 1000CubicCM) - Add shared controller instance using TestInitialize in SkittleControllerTests - Use Assert.Throws<Exception> for exception testing (MSTest 4.x compatible) - Fix quantity type consistency (1 -> 1f) Co-authored-by: samsmithnz <8389039+samsmithnz@users.noreply.github.com>
Co-authored-by: samsmithnz <8389039+samsmithnz@users.noreply.github.com>
samsmithnz
approved these changes
Dec 4, 2025
Copilot
AI
changed the title
[WIP] Use Assert.AreEqual for clearer test failure messages
Improve test assertions for clearer failure messages and MSTest 4.x compatibility
Dec 4, 2025
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.
Refactors test assertions to provide better failure diagnostics and updates exception testing to use MSTest 4.x APIs.
Assertion improvements
Assert.IsTrue(x == y)withAssert.AreEqual(expected, actual)for meaningful failure messagesTest method naming
ControllerCountPeanutMandMsInAUSCupTest→ControllerCountPeanutMandMsInAmericanCupTestControllerCountPeanutMandMsInA1CubicCMTest→ControllerCountPeanutMandMsInA1000CubicCMTest(test uses 10x10x10)Shared test setup
[TestInitialize]inSkittleControllerTeststo reduce controller instantiation duplicationException testing (MSTest 4.x)
Assert.Throws<Exception>()(Assert.ThrowsExceptionwas removed in MSTest 4.x)Type consistency
float quantity = 1→float quantity = 1ffor consistency across test filesOriginal 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.