Skip to content

Add PackageRepository.Package overload that accept .nupkg file - #276

Merged
jeffkl merged 1 commit into
jeffkl:mainfrom
MattKotsenas:feature/package-from-nupkg
Mar 8, 2024
Merged

jeffkl merged 1 commit into
jeffkl:mainfrom
MattKotsenas:feature/package-from-nupkg

Conversation

@MattKotsenas

Copy link
Copy Markdown
Contributor

This change inspired from the discussion in #265.

The overall goal is to make it easier to produce packages as part of a solution and then run integration tests. As mentioned in the linked issue, NuGet packages are supposed to be immutable, and thus ensuring that the correct version of the package is being used and tested is critical.

Rather than use NuGet source mappings or other techniques to ensure the correct package is installed, introduce an overload of PackageRepository.Package() that accepts a FileInfo that points to a .nupkg file. That package is unpacked and a new Package is created to hold the unpacked contents.

From there tests can proceed as normal, bypassing the need to interact with feeds entirely.

Also added unit tests (using a PackageFeed.Package as the source) to validate.

@MattKotsenas

Copy link
Copy Markdown
Contributor Author

Let me know if you disagree with this idea. I think it's a simpler way to consume a .nupkg file in tests without needing to make the API more complicated by also supporting package source mappings. I can still go that route instead if you prefer.

@jeffkl
jeffkl merged commit ca14cff into jeffkl:main Mar 8, 2024
@MattKotsenas
MattKotsenas deleted the feature/package-from-nupkg branch March 8, 2024 03:41
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