Skip to content

Fix warnings#3056

Merged
MrHinsh merged 10 commits intonkdAgility:mainfrom
satano:fixWarnings
Nov 8, 2025
Merged

Fix warnings#3056
MrHinsh merged 10 commits intonkdAgility:mainfrom
satano:fixWarnings

Conversation

@satano
Copy link
Copy Markdown
Collaborator

@satano satano commented Nov 8, 2025

I do not like warnings, because I treat them as potential errors. :) So I fixed all warnings in the project, that could be fixed. Remaining warnings during build are now only those regarding mixing old and new .NET.

Fixed warnings

  • CS0168 The variable 'ex' is declared but never used
  • MSTEST0001 Explicitly enable or disable tests parallelization (https://learn.microsoft.com/dotnet/core/testing/mstest-analyzers/mstest0001)
  • MSTEST0017 Assertion arguments should be passed in the correct order. 'actual' and 'expected'/'notExpected' arguments have been swapped.
  • MSTEST0037 Use proper asertion methods:
    • Use 'Assert.IsEmpty' instead of 'Assert.AreEqual'
    • Use 'Assert.HasCount' instead of 'Assert.AreEqual'
    • Use 'Assert.IsTrue' instead of 'Assert.AreEqual'
    • Use 'Assert.AreEqual' instead of 'Assert.IsTrue'
  • MSTEST0044 'DataTestMethod' is obsolete. Use 'TestMethod' instead.
  • MSTEST0056 Use the 'DisplayName' property instead of passing a string argument to TestMethodAttribute
  • NU1504 Duplicate 'PackageReference' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. The duplicate 'PackageReference' items are: Newtonsoft.Json , Newtonsoft.Json.

Summary by CodeRabbit

Release Notes

  • Tests

    • Enabled parallel test execution at class level across test suites.
    • Updated test assertions for consistency and standardisation.
  • Chores

    • Removed unused JSON serialisation package dependencies.
    • Cleaned up imports and improved code formatting throughout tests.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 8, 2025

Walkthrough

This PR introduces parallel test execution at class level across multiple test assemblies via MSTest attributes, refactors test assertions to use more expressive methods, removes unused using directives, simplifies exception handling, and prunes unused NuGet dependencies from the ConsoleDataGenerator project.

Changes

Cohort / File(s) Summary
Test Assembly Parallelization
src/MigrationTools.Clients.AzureDevops.Rest.Tests/AssemblyInfo.cs, src/MigrationTools.Clients.FileSystem.Tests/AssemblyInfo.cs, src/MigrationTools.Clients.TfsObjectModel.Tests/AssemblyInfo.cs, src/MigrationTools.Host.Tests/AssemblyInfo.cs, src/MigrationTools.Tests/AssemblyInfo.cs
Added MSTest using directive and assembly-level [Parallelize(Scope = ExecutionScope.ClassLevel)] attribute to enable class-level parallel test execution.
TfsObjectModel Tests Cleanup
src/MigrationTools.Clients.TfsObjectModel.Tests/Processors/TfsSharedQueryProcessorTests.cs, src/MigrationTools.Clients.TfsObjectModel.Tests/Processors/TfsWorkItemMigrationProcessorTests.cs
Removed unused using directives; converted TestMethod positional display-name arguments to named DisplayName parameters.
TfsTeamSettingsProcessor Tests
src/MigrationTools.Clients.TfsObjectModel.Tests/Processors/TfsTeamSettingsProcessorTests.cs
Removed unused Microsoft.Extensions.DependencyInjection using; corrected assertion argument order from (actual, expected) to (expected, actual).
TfsRevisionManager Tests
src/MigrationTools.Clients.TfsObjectModel.Tests/Tools/TfsRevisionManagerTests.cs
Replaced Count-based assertions with IsEmpty and HasCount methods; converted Assert.AreEqual(true, ...) to Assert.IsTrue(...); removed unused using.
WorkItemMigration Tests & Core
src/MigrationTools.Tests/Core/Clients/WorkItemMigrationClientTests.cs, src/MigrationTools.Tests/Options/OptionsConfigurationUpgraderTfsNodeStructureTests.cs, src/MigrationTools.Tests/Tools/FieldMaps/FieldCalculationMapTests.cs
Replaced Count-based equality assertions with HasCount and IsEmpty for collection validation; normalised whitespace.
StringManipulator Tests
src/MigrationTools.Tests/ProcessorEnrichers/StringManipulatorEnricherTests.cs
Removed unused using; replaced DataTestMethod with TestMethod whilst retaining DataRow attributes (potential semantic impact).
Source Code Cleanup
src/MigrationTools.Clients.TfsObjectModel/Processors/TfsWorkItemMigrationProcessor.cs
Removed unused exception variable from catch block (catch (FieldDefinitionNotExistException) instead of catch (FieldDefinitionNotExistException ex)).
Project Dependencies
src/MigrationTools.ConsoleDataGenerator/MigrationTools.ConsoleDataGenerator.csproj
Removed PackageReference entries for Newtonsoft.Json and Newtonsoft.Json.Schema.

Sequence Diagram(s)

Not applicable—these are predominantly test infrastructure and assertion refactorings without meaningful control-flow changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attention required:
    • src/MigrationTools.Tests/ProcessorEnrichers/StringManipulatorEnricherTests.cs: Changing DataTestMethod to TestMethod whilst keeping DataRow attributes is a breaking semantic change; verify the intent and whether data-driven execution remains desired.
    • All assertion argument order corrections: spot-check a few to confirm convention is consistently (expected, actual).
    • Dependency removal in ConsoleDataGenerator: confirm no transitive dependency on Newtonsoft.Json remains elsewhere.

Possibly related PRs

Poem

🧪 Tests now run in parallel, class by class,
Assertions speak clearer—HasCount beats brute force
Exception variables shed like autumn leaves
Dependencies pruned where they're not needed
MSTest harnesses the cores, pragmatism prevails 🚀

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'Fix warnings' is vague and generic, using non-descriptive language that fails to convey the specific nature or scope of changes across multiple test assemblies and compiler warnings being addressed. Specify which categories of warnings are fixed (e.g., 'Fix MSTEST warnings and unused variable warnings across test projects') to give reviewers meaningful context about the changeset scope.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MrHinsh
Copy link
Copy Markdown
Member

MrHinsh commented Nov 8, 2025

I love your work @satano

@MrHinsh MrHinsh enabled auto-merge November 8, 2025 16:53
@MrHinsh MrHinsh merged commit 56748e3 into nkdAgility:main Nov 8, 2025
12 checks passed
@satano satano deleted the fixWarnings branch November 9, 2025 08:44
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