Running Tests for the Project
Prerequisites
Ensure that you have the necessary environment set up, including the .NET SDK and PowerShell.
Running Unit Tests
Using an IDE
You can execute the unit tests for Intellenum directly within your IDE. Open the test explorer feature in your IDE and run all tests that are identified for the Intellenum project.Via Build.ps1
To run the unit tests using PowerShell, you can utilize theBuild.ps1
script included in the repository. Execute the following command:.\Build.ps1
This script will automatically run the analyzer tests and execute the appropriate test runner with specified options:
WriteStage("Running analyzer tests...") exec { & dotnet test tests/AnalyzerTests/AnalyzerTests.csproj -c $buildConfig --no-build -l trx -l "GitHubActions;report-warnings=false" --verbosity $verbosity }
In this command, ensure that you have defined
$buildConfig
and$verbosity
as needed.
Running Snapshot Tests
To run the snapshot tests, execute the RunSnapshots.ps1
PowerShell script. Use the following command:
.\RunSnapshots.ps1
This script will validate that the source code generated by Intellenum matches the expected output, executing predefined snapshot tests.
Additional Configuration
When you run the unit and snapshot tests, make sure that your local environment is configured to build with a version of 999.9.xxx
, as this ensures the tests will run correctly. This configuration provides faster execution and verifies critical behaviors such as equality, hashing, ToString
, validation, and instance fields for created Value Objects.
Example of Running Tests
Here’s a brief example of what executing the tests would look like:
# Running unit tests using Build.ps1
.\Build.ps1
# Running snapshot tests
.\RunSnapshots.ps1
Ensure your console outputs indicate successful execution of the tests without errors.