Skip to content

Replace deprecated MSTest assertions with v4 equivalents#53

Merged
Malcolmnixon merged 2 commits intomainfrom
copilot/fix-assert-usage-in-tests
Feb 8, 2026
Merged

Replace deprecated MSTest assertions with v4 equivalents#53
Malcolmnixon merged 2 commits intomainfrom
copilot/fix-assert-usage-in-tests

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

Pull Request

Description

MSTest v4 provides specialized assertions for collection operations. Replaced Assert.AreEqual with semantic equivalents in GitHubGraphQLClientTests.cs:

  • Assert.AreEqual(count, collection.Count)Assert.HasCount(count, collection)
  • Assert.AreEqual(0, collection.Count)Assert.IsEmpty(collection)

Before:

Assert.AreEqual(3, issueIds.Count);
Assert.AreEqual(0, issueIds.Count);

After:

Assert.HasCount(3, issueIds);
Assert.IsEmpty(issueIds);

7 assertions updated across 7 test methods.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement

Related Issues

N/A

Pre-Submission Checklist

Before submitting this pull request, ensure you have completed the following:

Build and Test

  • Code builds successfully: dotnet build --configuration Release
  • All tests pass: dotnet test --configuration Release
  • Code produces zero warnings

Code Quality

  • Code formatting is correct: dotnet format --verify-no-changes
  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

Please run the following checks before submitting:

  • Spell checker passes: cspell "**/*.{md,cs}"
  • Markdown linter passes: markdownlint "**/*.md"
  • YAML linter passes: yamllint '**/*.{yml,yaml}'

Testing

  • Added unit tests for new functionality
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable)
  • Updated ARCHITECTURE.md (if applicable)
  • Added code examples for new features (if applicable)
  • Updated requirements.yaml (if applicable)

Additional Notes

No behavioral changes. All 119 tests pass.

Original prompt

Please fix the following issues:

test/DemaConsulting.BuildMark.Tests/GitHubGraphQLClientTests.cs(64): INFO CODE_SMELL [external_roslyn:MSTEST0037] Use 'Assert.HasCount' instead of 'Assert.AreEqual'  
test/DemaConsulting.BuildMark.Tests/GitHubGraphQLClientTests.cs(97): INFO CODE_SMELL [external_roslyn:MSTEST0037] Use 'Assert.IsEmpty' instead of 'Assert.AreEqual'  
test/DemaConsulting.BuildMark.Tests/GitHubGraphQLClientTests.cs(121): INFO CODE_SMELL [external_roslyn:MSTEST0037] Use 'Assert.IsEmpty' instead of 'Assert.AreEqual'  
test/DemaConsulting.BuildMark.Tests/GitHubGraphQLClientTests.cs(141): INFO CODE_SMELL [external_roslyn:MSTEST0037] Use 'Assert.IsEmpty' instead of 'Assert.AreEqual'  
test/DemaConsulting.BuildMark.Tests/GitHubGraphQLClientTests.cs(161): INFO CODE_SMELL [external_roslyn:MSTEST0037] Use 'Assert.IsEmpty' instead of 'Assert.AreEqual'  
test/DemaConsulting.BuildMark.Tests/GitHubGraphQLClientTests.cs(193): INFO CODE_SMELL [external_roslyn:MSTEST0037] Use 'Assert.HasCount' instead of 'Assert.AreEqual'  
test/DemaConsulting.BuildMark.Tests/GitHubGraphQLClientTests.cs(228): INFO CODE_SMELL [external_roslyn:MSTEST0037] Use 'Assert.HasCount' instead of 'Assert.AreEqual'  

💡 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.

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix assertion methods in GitHubGraphQLClientTests Replace deprecated MSTest assertions with v4 equivalents Feb 8, 2026
Copilot AI requested a review from Malcolmnixon February 8, 2026 03:13
@Malcolmnixon Malcolmnixon marked this pull request as ready for review February 8, 2026 03:20
@Malcolmnixon Malcolmnixon merged commit 13b3998 into main Feb 8, 2026
11 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/fix-assert-usage-in-tests branch February 8, 2026 03:20
Copilot AI added a commit that referenced this pull request Mar 7, 2026
…ompliance, macOS support, CodeQL build-mode

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Malcolmnixon added a commit that referenced this pull request Mar 7, 2026
* Initial plan

* Apply TemplateDotNetTool changes from PRs #53, #54, #55: Continuous Compliance, macOS support, CodeQL build-mode

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
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.

2 participants