Skip to content

Commit 42c0960

Browse files
Copilotnkolev92
andcommitted
Remove InstallPackageFromPMC_TriggersNuGetCacheUpdatedEventAsync test and revert SolutionManager property
Agent-Logs-Url: https://github.com/NuGet/NuGet.Client/sessions/4ff4fd9e-2c3b-4f98-bd0d-250dd8408f55 Co-authored-by: nkolev92 <[email protected]>
1 parent edbd5ad commit 42c0960

3 files changed

Lines changed: 0 additions & 107 deletions

File tree

test/EndToEnd/tests/NetCoreProjectTest.ps1

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -30,66 +30,6 @@ function Test-NetCoreProjectSystemCacheUpdateEvent {
3030
Assert-NotNull $cacheEvent -Message "Cache update event should've been raised"
3131
}
3232

33-
function Test-NetCoreConsoleAppClean {
34-
35-
# Arrange & Act
36-
$project = New-NetCoreConsoleApp ConsoleApp
37-
38-
Build-Solution
39-
40-
Assert-ProjectCacheFileExists $project
41-
42-
#Act
43-
Clean-Solution
44-
45-
#Assert
46-
Assert-ProjectCacheFileNotExists $project
47-
}
48-
49-
function Test-NetCoreConsoleAppRebuildDoesNotDeleteCacheFile {
50-
# Arrange & Act
51-
$project = New-NetCoreConsoleApp ConsoleApp
52-
Build-Solution
53-
54-
Assert-ProjectCacheFileExists $project
55-
56-
AdviseSolutionEvents
57-
58-
#Act
59-
Rebuild-Solution
60-
61-
WaitUntilRebuildCompleted
62-
UnadviseSolutionEvents
63-
64-
#Assert
65-
Assert-ProjectCacheFileExists $project
66-
}
67-
68-
function Test-NetCoreVSandMSBuildNoOp {
69-
param ()
70-
71-
# Arrange
72-
$project = New-NetCoreConsoleApp ConsoleApp
73-
Build-Solution
74-
75-
Assert-ProjectCacheFileExists $project
76-
$cacheFile = Get-ProjectCacheFilePath $project
77-
78-
#Act
79-
80-
$VSRestoreTimestamp =( [datetime](Get-ItemProperty -Path $cacheFile -Name LastWriteTime).lastwritetime).Ticks
81-
82-
$MSBuildExe = Get-MSBuildExe
83-
84-
& "$MSBuildExe" /t:restore $project.FullName
85-
Assert-True ($LASTEXITCODE -eq 0)
86-
87-
$MsBuildRestoreTimestamp =( [datetime](Get-ItemProperty -Path $cacheFile -Name LastWriteTime).lastwritetime).Ticks
88-
89-
#Assert
90-
Assert-True ($MsBuildRestoreTimestamp -eq $VSRestoreTimestamp)
91-
}
92-
9333
function Test-NetCoreTargetFrameworksVSandMSBuildNoOp {
9434
param ()
9535

test/NuGet.Tests.Apex/NuGet.Tests.Apex/Apex/NuGetApexTestService.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using Microsoft.VisualStudio.Shell.Interop;
1919
using Microsoft.VisualStudio.Shell.ServiceBroker;
2020
using NuGet.Console.TestContract;
21-
using NuGet.PackageManagement;
2221
using NuGet.PackageManagement.UI.TestContract;
2322
using NuGet.SolutionRestoreManager;
2423
using NuGet.Versioning;
@@ -57,11 +56,6 @@ protected internal IVsSolutionRestoreStatusProvider SolutionRestoreStatusProvide
5756

5857
protected internal IVsPathContextProvider2 PathContextProvider2 => VisualStudioObjectProviders.GetComponentModelService<IVsPathContextProvider2>();
5958

60-
/// <summary>
61-
/// Gets the NuGet ISolutionManager
62-
/// </summary>
63-
protected internal ISolutionManager SolutionManager => VisualStudioObjectProviders.GetComponentModelService<ISolutionManager>();
64-
6559
/// <summary>
6660
/// Wait for all nominations and auto restore to complete.
6761
/// This uses an Action to log since the xunit logger is not fully serializable.

test/NuGet.Tests.Apex/NuGet.Tests.Apex/NuGetEndToEndTests/NetCoreProjectTestCase.cs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Diagnostics;
43
using System.IO;
5-
using System.Threading;
64
using System.Threading.Tasks;
75
using Microsoft.Test.Apex.VisualStudio.Solution;
86
using Microsoft.VisualStudio.TestTools.UnitTesting;
9-
using NuGet.PackageManagement;
107

118
namespace NuGet.Tests.Apex
129
{
@@ -237,44 +234,6 @@ public async Task WithSourceMappingEnabled_InstallPackageFromPMUIAndNoSourcesFou
237234
}
238235
}
239236

240-
// Migrated from Test-NetCoreProjectSystemCacheUpdateEvent in NetCoreProjectTest.ps1
241-
[TestMethod]
242-
[Timeout(DefaultTimeout)]
243-
public async Task InstallPackageFromPMC_TriggersNuGetCacheUpdatedEventAsync()
244-
{
245-
// Arrange
246-
using var testContext = new ApexTestContext(VisualStudio, ProjectTemplate.NetCoreConsoleApp, Logger, addNetStandardFeeds: true);
247-
248-
var packageName = "TestPackage";
249-
var packageVersion = "1.0.0";
250-
await CommonUtility.CreatePackageInSourceAsync(testContext.PackageSource, packageName, packageVersion);
251-
252-
testContext.SolutionService.Build();
253-
testContext.NuGetApexTestService.WaitForAutoRestore();
254-
255-
// Subscribe to the ISolutionManager.AfterNuGetCacheUpdated event
256-
using var cacheUpdatedEvent = new ManualResetEventSlim(false);
257-
var solutionManager = testContext.NuGetApexTestService.SolutionManager;
258-
void OnAfterNuGetCacheUpdated(object sender, NuGetEventArgs<string> e) => cacheUpdatedEvent.Set();
259-
solutionManager.AfterNuGetCacheUpdated += OnAfterNuGetCacheUpdated;
260-
261-
try
262-
{
263-
// Act
264-
var nugetConsole = GetConsole(testContext.Project);
265-
nugetConsole.InstallPackageFromPMC(packageName, packageVersion);
266-
267-
// Assert
268-
Assert.IsTrue(
269-
cacheUpdatedEvent.Wait(TimeSpan.FromSeconds(10)),
270-
"Cache update event should have been raised after package install.");
271-
}
272-
finally
273-
{
274-
solutionManager.AfterNuGetCacheUpdated -= OnAfterNuGetCacheUpdated;
275-
}
276-
}
277-
278237
// Migrated from Test-NetCoreVSandMSBuildNoOp in NetCoreProjectTest.ps1
279238
[TestMethod]
280239
[Timeout(DefaultTimeout)]

0 commit comments

Comments
 (0)