Skip to content

Migrate SyncPackageTest.ps1 PowerShell E2E tests to Apex C# tests#7270

Merged
nkolev92 merged 1 commit intodevfrom
copilot/migrate-end-to-end-tests
Apr 13, 2026
Merged

Migrate SyncPackageTest.ps1 PowerShell E2E tests to Apex C# tests#7270
nkolev92 merged 1 commit intodevfrom
copilot/migrate-end-to-end-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

Bug

Progress: https://github.com/nuget/client.engineering/issues/2085

Description

Migrates all 3 tests from test/EndToEnd/tests/SyncPackageTest.ps1 to a new Apex C# test class SyncPackageTestCase.cs in test/NuGet.Tests.Apex/NuGet.Tests.Apex/NuGetEndToEndTests/. The original PowerShell test file is deleted.

Migration Decision Table

PS Test Function Decision Apex Test Method Notes
Test-SyncPackagesInSolutionUp ✅ Migrated SyncPackageFromPMC_UpVersion_SyncsAllProjectsAsync Syncs package A from the higher-version project to all other projects. Verifies both A and transitive dependency B are updated in all projects.
Test-SyncPackagesInSolutionDown ✅ Migrated SyncPackageFromPMC_DownVersion_SyncsAllProjectsAsync Syncs package A from the lower-version project. Verifies A is downgraded across projects; transitive dependency B is not downgraded.
Test-SyncPackagesInSolutionPlural ✅ Migrated SyncPackageFromPMC_MultipleProjects_SyncsAllProjectsAsync Syncs package A from a middle version (3.0.0) across 5 projects, all different starting versions. Verifies all projects converge to 3.0.0.

Approach

  • Project types: ConsoleApplication (packages.config) + ClassLibrary (packages.config), matching the original New-ConsoleApplication / New-ClassLibrary PS helpers
  • Package creation: CommonUtility.CreateDependenciesPackageInSourceAsync() creates packages A with a declared dependency on B at corresponding versions, replacing $context.RepositoryPath local packages
  • PMC commands: nugetConsole.Execute() is used for all Install-Package (with -Version and -Source) and Sync-Package commands
  • Multi-project: additional projects are added via testContext.SolutionService.AddProject()
  • Assertions: CommonUtility.AssertPackageInPackagesConfig() and AssertPackageNotInPackagesConfig() replace Assert-Package and Assert-Null (Get-ProjectPackage ...)

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

Migrate all 3 tests from test/EndToEnd/tests/SyncPackageTest.ps1 to
test/NuGet.Tests.Apex/NuGet.Tests.Apex/NuGetEndToEndTests/SyncPackageTestCase.cs:

- Test-SyncPackagesInSolutionUp -> SyncPackageFromPMC_UpVersion_SyncsAllProjectsAsync
- Test-SyncPackagesInSolutionDown -> SyncPackageFromPMC_DownVersion_SyncsAllProjectsAsync
- Test-SyncPackagesInSolutionPlural -> SyncPackageFromPMC_MultipleProjects_SyncsAllProjectsAsync

Remove the original PS test file.

Agent-Logs-Url: https://github.com/NuGet/NuGet.Client/sessions/c06b5567-c16c-4ae8-9a1c-ccb07314f686

Co-authored-by: nkolev92 <[email protected]>
@nkolev92
Copy link
Copy Markdown
Member

I verified the tests are passing in NuGet.Client-VS.

@nkolev92 nkolev92 enabled auto-merge (squash) April 13, 2026 20:43
@nkolev92 nkolev92 merged commit 0abad6a into dev Apr 13, 2026
18 of 19 checks passed
@nkolev92 nkolev92 deleted the copilot/migrate-end-to-end-tests branch April 13, 2026 23:17
Copilot stopped work on behalf of nkolev92 due to an error April 15, 2026 19: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.

3 participants