Conversation
…projects. (#2) * Create codeql.yml * Update CodeQL workflow to use .NET 9.0.x Changed the dotnet-version in the CodeQL GitHub Actions workflow from 8.0.x to 9.0.x to align with the project's SDK requirements. * Set fetch-depth to 0 in CodeQL workflow Updated the checkout step in the CodeQL workflow to use 'fetch-depth: 0', ensuring the full git history is available for analysis.
Updated dotnet and sonarqube GitHub Actions workflows to trigger on both main and develop branches for push and pull request events. This ensures CI processes run for changes targeting the develop branch.
The build step in the GitHub Actions workflow now runs 'dotnet build' without the '--no-restore' flag, ensuring dependencies are restored during the build process.
* Remove --no-restore from dotnet build step The build step in the GitHub Actions workflow now runs 'dotnet build' without the '--no-restore' flag, ensuring dependencies are restored during the build process. * Update dotnet.yml
Introduces a dependabot.yml file to enable automated weekly updates for NuGet dependencies in the repository.
Introduces a modular and SOLID-compliant test suite for CommandHandlerBase, including constructor validation, edge case, and shared test infrastructure. Adds new test classes, helpers, and a detailed README describing the new structure. Also adds Moq as a test dependency.
Introduces tests covering core functionality of the HandleAsync method in CommandHandlerBase, including event envelope creation, ULID generation, timestamp handling, serialization, storage, and abstract method calls.
Switch SonarQube workflow from Windows to Ubuntu, update path separators for Unix compatibility, and remove PowerShell-specific commands. Minor formatting improvements were made to the dotnet workflow for consistency.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a comprehensive suite of unit tests for the CommandHandlerBase<TCommand, TEvent> class, refactors test infrastructure for better maintainability, and updates CI workflows to run tests on the develop branch.
- Adds Moq as a test dependency in the test project’s csproj.
- Introduces shared test fixtures, helper classes, and three focused test classes covering constructor validation, core
HandleAsyncfunctionality, and edge cases. - Updates GitHub Actions workflows to include the
developbranch and adjusts build steps.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| MathMax.EventSourcing.UnitTests/MathMax.EventSourcing.UnitTests.csproj | Adds Moq package reference for mocking dependencies in tests. |
| MathMax.EventSourcing.UnitTests/Commands/CommandHandlerBase/TestHelpers.cs | Defines test commands/events and concrete/spy handlers for testing. |
| MathMax.EventSourcing.UnitTests/Commands/CommandHandlerBase/README.md | Documents the refactored test architecture and guidelines. |
| MathMax.EventSourcing.UnitTests/Commands/CommandHandlerBase/CommandHandlerBaseTestFixture.cs | Provides shared mocks, factories, and verification helpers. |
| MathMax.EventSourcing.UnitTests/Commands/CommandHandlerBase/CommandHandlerBaseConstructorTests.cs | Validates constructor parameter checks and exception behavior. |
| MathMax.EventSourcing.UnitTests/Commands/CommandHandlerBase/CommandHandlerBaseHandleAsyncTests.cs | Tests core HandleAsync behavior, ULID generation, and serialization/storage. |
| MathMax.EventSourcing.UnitTests/Commands/CommandHandlerBase/CommandHandlerBaseEdgeCaseTests.cs | Covers null‐aggregate‐ID, null‐version, and event type name edge cases. |
| .github/workflows/sonarqube.yml | Includes develop branch in SonarQube analysis triggers. |
| .github/workflows/dotnet.yml | Runs build and test jobs on both main and develop branches. |
Comments suppressed due to low confidence (2)
MathMax.EventSourcing.UnitTests/Commands/CommandHandlerBase/CommandHandlerBaseEdgeCaseTests.cs:32
- Add a verification step (e.g.,
dependencies.VerifySerializationAndStorage(...)) after this assertion to ensure the serializer and event store were still called for the null-aggregate-ID scenario.
Assert.Null(result.AggregateId);
.github/workflows/dotnet.yml:30
- Reintroduce the
--no-restoreflag ondotnet build --no-restoreto avoid redundant package restore and speed up the CI build.
run: dotnet build
Adds setup for .NET 9.0, configures SonarQube scanner to use OpenCover reports, and updates test command to collect code coverage in OpenCover format. These changes improve code analysis and ensure compatibility with the latest .NET version.
…s.csproj Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Changed CreateTestCommand to a static method in CommandHandlerBaseTestFixture for easier access without instantiation. Updated a test in CommandHandlerBaseConstructorTests to use Assert.IsType with exactMatch: false instead of Assert.IsAssignableFrom.
…/MathMax.Administration into feature/add-unit-tests
Replaced usage of _fixture.CreateTestCommand() with CommandHandlerBaseTestFixture.CreateTestCommand() in CommandHandlerBaseEdgeCaseTests and CommandHandlerBaseHandleAsyncTests for consistency and clarity.
Split TestHelpers.cs into individual files for each test class: TestCommand, TestEvent, TestCommandHandler, SpyTestCommandHandler, TestCommandHandlerWithNullAggregateId, and TestCommandHandlerWithNullVersion. This improves code organization and maintainability.
|
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.



No description provided.