Conversation
Apply the detailed arrange/act/assert structure to all tests.
There was a problem hiding this comment.
Pull Request Overview
This PR restructures and cleans up code across the solution, refactors all tests to a consistent Arrange–Act–Assert style (with improved naming and XML doc comments), and bumps several project and tool dependencies.
- Standardize test method names and add descriptive comments
- Apply new C# 12 collection/array expression syntax and clone patterns in deep-copy implementations
- Upgrade NuGet and .NET tool versions, including System.Text.Json, MSTest, and sbom-tool dependencies
Reviewed Changes
Copilot reviewed 61 out of 68 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/DemaConsulting.SpdxModel/Transform/SpdxRelationships.cs | Add line wrapping and C#12 collection expressions |
| test/** | Rename tests, apply Arrange/Act/Assert sections, update XML docs |
| *.csproj & dotnet-tools.json | Bump dependency versions |
| src/DemaConsulting.SpdxModel/Spdx* & IO/*.cs | Implement deep-copy braces, spread operators, Enhance refactors |
| DemaConsulting.SpdxModel.sln.DotSettings | Add a ReSharper formatting setting |
Comments suppressed due to low confidence (1)
DemaConsulting.SpdxModel.sln.DotSettings:1
- The XML namespace URI is misspelled as
shemas-jetbrains-com. It should beschemas-jetbrains-com.
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
| @@ -43,7 +45,8 @@ public static void Add(SpdxDocument document, SpdxRelationship relationship) | |||
|
|
|||
| // Ensure the relationship related-element ID matches an element | |||
| if (document.GetElement(relationship.RelatedSpdxElement) == null) | |||
There was a problem hiding this comment.
Add a check to validate that the Id of the incoming relationship also exists in document before adding. Currently only RelatedSpdxElement is validated, so bad Id values slip through without throwing.
| throw new ArgumentException($"Element {relationship.RelatedSpdxElement} not found in SPDX document", | ||
| nameof(relationship)); |
There was a problem hiding this comment.
The thrown ArgumentException uses the two-parameter ctor which prepends a new line and Parameter name: text. Tests expect a single-line message with (Parameter 'relationship'). Either adjust the exception message formatting or update tests to assert against ex.ParamName and the actual multi-line Message.
| throw new ArgumentException($"Element {relationship.RelatedSpdxElement} not found in SPDX document", | |
| nameof(relationship)); | |
| throw new ArgumentException($"Element {relationship.RelatedSpdxElement} not found in SPDX document (Parameter '{nameof(relationship)}')"); |
This PR performs extensive code cleanup and restructuring, including: