Repository navigation
[Data Model Improvements] Add Transitive and Installed package models - #6313
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request adds models for transitive and installed packages and updates related tests and supporting classes. Key changes include:
- Addition of InstalledPackageModel and TransitivePackageModel classes along with corresponding tests.
- Updates to PackageModel, LocalPackageModel, and RemotePackageModel constructors to include a published date.
- Adjustments in test cases to account for changes in dependency set handling.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/InstalledPackageModelTests.cs | Added tests verifying the ReportAbuseUrl initialization. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/TransitivePackageModelTests.cs | Added tests to validate transitive origins in the TransitivePackageModel. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/TransitivePackageModel.cs | Introduced TransitivePackageModel inheriting from InstalledPackageModel with transitive origins. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/InstalledPackageModel.cs | Extended InstalledPackageModel to include ReportAbuseUrl initialization. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/PackageModel.cs | Updated the constructor to pass a published date to the model. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/LocalPackageModel.cs | Updated the constructor with additional parameters for consistency. |
| src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/RemotePackageModel.cs | Modified the constructor to use a publishedDate parameter and removed dependency set property assignment. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/RemotePackageModelTests.cs | Adjusted tests to match the modified constructor signature and removed dependency set assertions. |
| test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/TestPackageModel.cs | Updated the dependencySets parameter type to IReadOnlyCollection for consistency. |
Comments suppressed due to low confidence (3)
src/NuGet.Clients/NuGet.PackageManagement.UI/Models/Package/RemotePackageModel.cs:37
- The removal of the DependencySets property assignment may lead to loss of dependency set data in RemotePackageModel. If this change is intentional, please update the documentation and verify that all consumers are aware of the removal.
- DependencySets = dependencySets;
test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/RemotePackageModelTests.cs:54
- The removal of the dependencySets assertion in the test indicates that RemotePackageModel no longer exposes dependency set data. Confirm that this behavior is intended and that any related documentation or consumer code is updated accordingly.
- Assert.Equal(dependencySets, package.DependencySets);
test/NuGet.Clients.Tests/NuGet.PackageManagement.UI.Test/Models/Package/RemotePackageModelTests.cs:45
- [nitpick] Consider renaming the 'dateTimeOffset' variable in this test to 'publishedDate' to match the updated parameter naming in the RemotePackageModel constructor.
var package = new TestRemotePackageModel(identity, vulnerableCapability.Object, null, null, null, null, null, null, isListed, dateTimeOffset, packageDetailsUrl, downloadCount);
|
|
||
| namespace NuGet.PackageManagement.UI.Models | ||
| { | ||
| public class ReferencedPackageModel : LocalPackageModel |
There was a problem hiding this comment.
We talked about this offline. ReferencedPackageModel is not a type of LocalPackageModel as this inheritance hierarchy suggests. We will consider having both these package types share a base class or local capability of sorts. We can handle that in a future PR.
…#6313) * Updated model * Updated to include readme * Add class modifiers * rename * remove newline
…#6313) * Updated model * Updated to include readme * Add class modifiers * rename * remove newline
Bug
Fixes:
Description
Add Transitive and Installed package models
PR Checklist
Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.